
jQuery.easing.def = 'easeInOutCirc';

var screenHorCenter = 0;
var screenVerCenter = 0;
var frameWidth = 1440;
var frameHeight = 768;
var flagMovedTo = 0;

function getScreenCenter() {
	winH2 = (document.body.offsetHeight > document.body.scrollHeight) ? document.body.offsetHeight : document.body.scrollHeight;
	winH = document.documentElement.clientHeight;
	
	if (winH2 >= winH) {
		winH = winH2;
		//winH = document.body.clientHeight;
	}

	winW2 = document.documentElement.clientWidth;
	winW = document.getElementById('dummy_dumentions').offsetWidth;
	
	if (winW2 >= winW) {
		winW = winW2;
		//alert(winW +'='+ winW2+'='+document.getElementById('spacer').offsetWidth);
		//winW = document.body.clientWidth;
	}
					
	d = new Array(2);
	d[0] = winW/2;
	d[1] = winH/2;
	d[2] = winW;
	
	return d;
}

function changeCenter(){

	var dimentions = getScreenCenter();
	screenHorCenter = dimentions[0] - (frameWidth/2);
	screenVerCenter = dimentions[1] - (frameHeight/2);
	document.getElementById('slider').style.left = (flagMovedTo+screenHorCenter)+'px';
	document.getElementById('footer').style.left = (flagMovedTo+((document.documentElement.clientWidth/2) - (frameWidth/2)))+'px';
	document.getElementById('spacer').style.width =  dimentions[2]+'px';
	document.getElementById('menu').style.left = ((document.documentElement.clientWidth/2) - 162 )+'px';
	
}


function slideVert(pos){

	$('#content_holder').animate({top:pos}, {duration: 500, easing: 'easeInOutQuad'});

}


	function goToFrame_1(v_pos){
		//displayContent('index.php?mod=main&Page=2', 'frame_1');
		closeMenu();
		$('#slider').animate({left:0+screenHorCenter}, {duration: 1000, easing: 'easeInOutQuad'});
		$('#footer').animate({left:0+screenHorCenter}, {duration: 1500, easing: 'easeInOutQuad',
			complete: function() { // the callback
				document.getElementById('frame_1').contentWindow.slideVert(v_pos);
			}					 
							 
		});
		flagMovedTo = 0;
		//StopSwap(this);
	}
	
	function goToFrame_2(v_pos){
		//displayContent('index.php?mod=main&Page=3', 'frame_2');
		closeMenu();
		$('#slider').animate({left:-1440+screenHorCenter}, {duration: 1000, easing: 'easeInOutQuad'});
		$('#footer').animate({left:-1440+screenHorCenter}, {duration: 1500, easing: 'easeInOutQuad',
			complete: function() { // the callback
				document.getElementById('frame_2').contentWindow.slideVert(v_pos);
			}
			
		});
		//displayContent("Pages/Homepage_Text.htm","Pages/Homepage_Media.htm","1");
		flagMovedTo = -1440;
		//StopSwap(this);
	}
	
	function goToFrame_3(v_pos){
		//displayContent('index.php?mod=main&Page=4', 'frame_3');
		closeMenu();
		$('#slider').animate({left:-2880+screenHorCenter}, {duration: 1000, easing: 'easeInOutQuad'});
		$('#footer').animate({left:-2880+screenHorCenter}, {duration: 1500, easing: 'easeInOutQuad',
			complete: function() { // the callback
				document.getElementById('frame_3').contentWindow.slideVert(v_pos);
			}
		});
		//displayContent("Pages/Homepage_Text.htm","Pages/Homepage_Media.htm","1");
		flagMovedTo = -2880;
		//StopSwap(this);
	}
	
	function goToFrame_4(v_pos){
		closeMenu();
		//displayContent('index.php?mod=main&Page=5', 'frame_4');
		$('#slider').animate({left:-4320+screenHorCenter}, {duration: 1000, easing: 'easeInOutQuad'});
		$('#footer').animate({left:-4320+screenHorCenter}, {duration: 1500, easing: 'easeInOutQuad',
			complete: function() { // the callback
				document.getElementById('frame_4').contentWindow.slideVert(v_pos);
			}
		});
		//displayContent("Pages/Homepage_Text.htm","Pages/Homepage_Media.htm","1");
		flagMovedTo = -4320;
		//StopSwap(this);
	}
