function show_fr()
{
	var obj = document.getElementById('quick_form');
	dt = new Date();
	desc_rqst = dt.getTime();
	jQuery('#quick_form').css({display: "block"});
	frmsUpload('href_upload', desc_rqst);
	jQuery('#descFrom').val(desc_rqst);
   	cr = offseWdthHght();
   	obj.style.left 	= cr['x'] + "px";
   	//obj.style.top	= cr['y'] + "px";
}

// JavaScript Document
/*
 * Загрузка изображений
 * @param string  - idElmt (id элемента для которого делается загрузка)
 */
function frmsUpload(idElmt, descFrom)
{
	var upload = jQuery('#'+ idElmt +'').upload({
		name: 'file',
	    method: 'post',
	    enctype: 'multipart/form-data',
	    action: 'http://www.newlinestudio.ru/classphp/ajax.php',
	    params:{act: 'upload', descFrom: descFrom},
	    onComplete: function(data) {
	    	showUploadFiles(descFrom);
	    }
	});
}

function sentDataForm()
{  
	fio = escape(jQuery('#fio').val());
	company = escape(jQuery('#company').val());
	telephone = escape(jQuery('#telephone').val());
	email = escape(jQuery('#email').val());
	descript = escape(jQuery('#descript').val());
	descFrom = jQuery('#descFrom').val();
	str = 'fio=' + fio + '&company=' + company + '&telephone=' + telephone + '&email=' + email + '&descript=' + descript + '';
	jQuery.post("http://www.newlinestudio.ru/classphp/ajax.php?act=sentClaim&descFrom=" + descFrom + "&" + str +"",{}, function(data){
		alert('Ваша заявка успешно отправлена!');
		closeFormFile();
		return false;
	  }, "html");
}

function closeFormFile()
{
	var is_ie = check_browser();
	if(is_ie){
		quckfr = document.getElementById("quick_form");
		quckfr.style.display = "none";
	}
	else{
		jQuery('#quick_form').css({display: "none"});
	}
	fio = jQuery('#fio').val('');
	company = jQuery('#company').val('');
	telephone = jQuery('#telephone').val('');
	email = jQuery('#email').val('');
	descript = jQuery('#descript').val('');
	descFrom = jQuery('#descFrom').val('');
	jQuery('#bodyFile').html('');
}

function check_browser()
{
  if ( navigator && navigator.userAgent.toLowerCase().indexOf("msie") == -1 ) return false;
  else return true;
}

function dltUploadFile(flsID)
{
	jQuery.post("http://www.newlinestudio.ru/classphp/ajax.php?act=dltFile&flsID=" + flsID + "",{}, function(data){
		jQuery('#tr_file_' + flsID + '').empty();
		return false;
	  }, "html");	
}

function showUploadFiles(descFrom)
{
	jQuery.post("http://www.newlinestudio.ru/classphp/ajax.php?act=showUploadFiles&descFrom=" + descFrom + "",{}, function(data){
		jQuery('#bodyFile').html(data);
		return false;
	  }, "html");
}

/**
 * Функция определяет, позицию вслывающего окна относительно ширины и высоты (обязательно по центру)
 */
function offseWdthHght()
{
	var rs = new Array();
	m = ((jQuery(window).width() / 2) - (jQuery('#quick_form').width() / 2));
	n = ((jQuery(window).height() / 2) - (jQuery('#quick_form').height() / 2) + 10);
	rs['x'] = m;
	rs['y'] = n;
	return rs;
}

/**
 * 
 */
function showScreenShots(elmtID)
{
jQuery("#" + elmtID + "a").lightbox();
  jQuery.Lightbox.construct({
    	"speed": 500,
    	"show_linkback": true,
    	"keys": {
			close:	"q",
			prev:	"z",
			next:	"x"
		},
		"opacity": 0.3,
		text: {
			image:		"Картинка",
			of:			"из",
			close:		"Закрыть",
			closeInfo:	"Завершить просмотр можно, кликнув мышью вне картинки.",
			help: {
				close:		"Закрыть",
				interact:	""
			},
			about: {
				text: 	"",
				title:	"",
				link:	""
			}
		},
		files: {
			images: {
				prev:		'../images/lightbox/prev.png',
				next:		'../images/lightbox/next.png',
				blank:		'../images/lightbox/blank.gif',
				loading:	'../images/lightbox/loading_ad.gif'
			}
		}
    });

}

/**
 * Страница коммерческих предложений открывающийся бокс commercialOffer.php
 */
function collapseBox(id_element)
{
	if(jQuery("#"+id_element+" .c").css("display") == "block") {
		jQuery("#"+id_element+" div.bOpen").addClass("bShut");
		jQuery("#"+id_element+" .c").slideUp(600);
	}
	else {
			jQuery("#"+id_element+" div.bShut").removeClass("bShut").addClass("bOpen");
			jQuery("#"+id_element+" .c").slideDown(600);
				
	}	
}

