﻿$(document).ready(function(){
	
	phones();
	$("#orderlink a").click(function(){
		$('#senformid').css('display','block');
		$('#sendresult').css('display','none');
		if(!$("#overlay").length){
			$("body").append('<div id="overlay"></div>');
			$wh = getClientHeight() + (getBodyScrollTop()*2);
			$whh = getClientWidth();
			$sfh = $("#slideformbox").height();
			$sfhh = $("#slideformbox").width();
			$off = ($whh-$sfhh)/2;
	
			docH = $(document).height();
			qfH = parseInt($("#questformbox").height()/2);
/*	$("#overlay").height(docH).fadeTo("normal",0.8, function(){
			$("#slideformbox").css({marginTop:0-qfH, visibility:"visible"});
		});*/
			if ($off<0) $off = 0;
			$("#overlay").height($(document).height());
			$("#slideformbox").animate({'right':$off},600);
		}
		return false;
	});
	$("#overlay, #slideformclose, #closeorder").live("click", function(){
		$("#overlay").remove();
		$("#slideformbox").css({'right':-800});
		$('div.formError').remove();
	});
	
	
});
$(window).resize(function(){
	phones();
   
});

/**/function getClientWidth(){return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;}
function getClientHeight(){return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;}
function getBodyScrollTop(){return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);}

function phones(){
	widthIns=getClientWidth();
	if ( widthIns<="1180") {
		$(".phones").css("width","16%");
		$(".line-hide").css("display","none");
		$("#insidebody .b-content").css("width","49%");
		}
	else {		$(".phones").css("width","auto");
	$("#insidebody .b-content").css("width","55%");
	$(".line-hide").css("display","block");}}

function background1(){
	brwswidth=getClientWidth();
	if (brwswidth<="1920" && brwswidth>="1681")
		{
			$(".image")/*.attr("src","img/bg1/1920.jpg").attr("width","1920")*/.attr("height","1032");
			$(".back").css("height","1032");
			$("#background").css("background-image",'url("img/bg1/1920.jpg")');
		}
	else if (brwswidth<="1680" && brwswidth>="1601")
		{
			$(".image")/*.attr("src","img/bg1/1680.jpg").attr("width","1680")*/.attr("height","974");
			$(".back").css("height","974");
			$("#background").css("background-image",'url("img/bg1/1680.jpg")');
		}
	else if (brwswidth<="1600" && brwswidth>="1441")
		{
			$(".image")/*.attr("src","img/bg1/1600.jpg").attr("width","1600")*/.attr("height","946");
			$(".back").css("height","946");
			$("#background").css("background-image",'url("img/bg1/1600.jpg")');
		}
	else if (brwswidth<="1440" && brwswidth>="1367")
		{
			$(".image")/*.attr("src","img/bg1/1440.jpg").attr("width","1440")*/.attr("height","906");
			$(".back").css("height","906");
			$("#background").css("background-image",'url("img/bg1/1440.jpg")');
		}
	else if (brwswidth<="1366" && brwswidth>="1281")
		{
			$(".image")/*.attr("src","img/bg1/1366.jpg").attr("width","1366")*/.attr("height","890");
			$(".back").css("height","890");
			$("#background").css("background-image",'url("img/bg1/1366.jpg")');
		}
	else if (brwswidth<="1280" && brwswidth>="1025")
		{
			$(".image")/*.attr("src","img/bg1/1280.jpg").attr("width","1280")*/.attr("height","866");
			$(".back").css("height","866");
			$("#background").css("background-image",'url("img/bg1/1280.jpg")');
		}
	else if (brwswidth<="1024")
		{
			$(".image")/*.attr("src","img/bg1/1024.jpg").attr("width","1024")*/.attr("height","798");
			$(".back").css("height","798");
			$("#background").css("background-image",'url("img/bg1/1024.jpg")');
		}
	else {
			$(".image")/*.attr("src","img/bg1/1680.jpg").attr("width","1680")*/.attr("height","974");
			$(".back").css("height","974");
			$("#background").css("background-image",'url("img/bg1/1680.jpg")');
	     }
	}
function background2(){
	brwswidth=getClientWidth();
	if (brwswidth<="1920" && brwswidth>="1681")
		{
			$(".image")/*.attr("src","img/bg2/1920.jpg").attr("width","1920")*/.attr("height","1119");
			$(".back").css("height","1119");
			$("#background").css("background-image",'url("img/bg2/1920.jpg")');
		}
	else if (brwswidth<="1680" && brwswidth>="1601")
		{
			$(".image")/*.attr("src","img/bg2/1680.jpg").attr("width","1680")*/.attr("height","974");
			$(".back").css("height","1036");
			$("#background").css("background-image",'url("img/bg2/1680.jpg")');
		}
	else if (brwswidth<="1600" && brwswidth>="1441")
		{
			$(".image")/*.attr("src","img/bg2/1600.jpg").attr("width","1600")*/.attr("height","946");
			$(".back").css("height","1011");
			$("#background").css("background-image",'url("img/bg2/1600.jpg")');
		}
	else if (brwswidth<="1440" && brwswidth>="1367")
		{
			$(".image")/*.attr("src","img/bg2/1440.jpg").attr("width","1440")*/.attr("height","906");
			$(".back").css("height","954");
			$("#background").css("background-image",'url("img/bg2/1440.jpg")');
		}
	else if (brwswidth<="1366" && brwswidth>="1281")
		{
			$(".image")/*.attr("src","img/bg2/1366.jpg").attr("width","1366")*/.attr("height","890");
			$(".back").css("height","930");
			$("#background").css("background-image",'url("img/bg2/1366.jpg")');
		}
	else if (brwswidth<="1280" && brwswidth>="1025")
		{
			$(".image")/*.attr("src","img/bg2/1280.jpg").attr("width","1280")*/.attr("height","866");
			$(".back").css("height","900");
			$("#background").css("background-image",'url("img/bg2/1280.jpg")');
		}
	else if (brwswidth<="1024")
		{
			$(".image")/*.attr("src","img/bg2/1024.jpg").attr("width","1024")*/.attr("height","768");
			$(".back").css("height","817");
			$("#background").css("background-image",'url("img/bg2/1024.jpg")');
		}
	else {
			$(".image")/*.attr("src","img/bg2/1680.jpg").attr("width","1680")*/.attr("height","974");
			$(".back").css("height","1036");
			$("#background").css("background-image",'url("img/bg2/1680.jpg")');
	     }
	}
