






$(document).ready(function(){

	//$('.backing').corners('6px');
	
	
	
	
	$("#addcomment, #sendmessage, #sendmessage2").fancybox({					
						'transitionIn'		: 'none',
						'transitionOut'		: 'none',
						'scrolling'   		: 'no',
						'imageScale'     	: false,
						'autoScale'     : 	false,			
						'overlayShow'		: true,
						'overlayOpacity' 	: 0.2,
						'overlayColor'		: '#000'
						});
						
						
	$("#order, #order_present, #order_informers, #order_flash, #order_web, #order_logo, #order_3d, #order_exp, #order_software, #order_poly").fancybox({					
						'transitionIn'		: 'none',
						'transitionOut'		: 'none',
						'scrolling'   		: 'no',
						'imageScale'     	: false,
						'autoScale'     : 	false,			
						'overlayShow'		: true,
						
						'overlayOpacity' 	: 0.2,
						'overlayColor'		: '#000'
						}); 
	
	
							
						
	$("a.blogpreview").fancybox({			
			'padding'       : 	25,
			'autoScale'     : 	false,			
			'imageScale'     	: false,
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	0, 
			'speedOut'		:	0, 
			'overlayShow'	:	true,			
			'centerOnScroll': 	true			
	});	
						
	//$.scrollTo( {top:'110px', left:'290px'}, 800 );
	
	//$.scrollTo( {left:'1440px'}, 800 );
	
	//alert(viewportwidth);
	
	var lastX, lastY;
	$('*').click(function(e){
		
		if (e.pageX!=lastX && e.pageY!=lastY) {
			lastX = e.pageX;
			lastY = e.pageY;
			
			//alert(e.pageX);
			//$.scrollTo( {left:lastX-viewportwidth/2+'px'} , 800 );
		}
		
	});
	
	
	var offset;
	var windowWidth;
	var windowHeight;
	$(function() {
		offset = $("#gohome").offset();
		windowWidth = $(window).width();
		windowHeight = $(window).height();
		
		$("#gohome").css({marginTop: windowHeight/2});
		
		$(window).scroll(function() {
			scrollGoHome();			
			//scrollGoHomeLogo();
		});
		
		$("#gohome").show();
		scrollGoHome();
		
		function scrollGoHome() {		
			var leftPadding = 0;
			if ($(window).scrollLeft() > offset.left) { 				
				$("#gohome").show();
				$("#gohome").css({marginLeft: $(window).scrollLeft() - offset.left + leftPadding});								
			} else {				
				$("#gohome").css({marginLeft: 0});
				$("#gohome").hide();
			};
		}
		
		function scrollGoHomeLogo() {		
			var leftPadding = 0;
			if ($(window).scrollLeft() > offset.left) { 
				$("#gohomelogo").show();
				$("#gohomelogo").css({marginLeft: $(window).scrollLeft() - offset.left + leftPadding});								
			} else {				
				$("#gohomelogo").delay(800).css({marginLeft: 0});
				//$("#gohomelogo").hide();
			};
		}
		
	});
	
	

	
	
});

var showedSWF;
function showSwf(swf, id, w, h)
{
	if (showedSWF!=id) {
		showedSWF = id;
		swfobject.embedSWF(swf, id, w, h, "9.0", null, null, {scale:"noscale"}, null);
	}
}




function getSizeScreen() {
 var viewportwidth;
 var viewportheight;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }

}

