<!--

/* +--------------------------------------+ */
/* |         (c) Jakub Uhlik, 2006        | */
/* +--------------------------------------+ */
/* |   jakub[DOT]uhlik[AT]gmail[DOT]com   | */
/* |      http://www.jakubuhlik.com/      | */
/* +--------------------------------------+ */
/* |      studio edita main library       | */
/* |           version: 4.0.1.1           | */
/* +--------------------------------------+ */


var lib = new Object();
function centerDivElement(what){
	var w = what;
	var elmW = parseInt(document.getElementById(w).style.width) / 2; var elmH = parseInt(document.getElementById(w).style.height) / 2;
	var centerX = Math.round( getInnerWidth(this) / 2 ); var centerY = Math.round( getInnerHeight(this) / 2 );
	var x = parseInt(centerX); var y = parseInt(centerY); var tpos = (x - elmW); var lpos = (y - elmH);
	if(tpos <= 0){ tpos = 0; } if(lpos <= 0){ lpos = 0; }
	document.getElementById(w).style.left = tpos + "px"; document.getElementById(w).style.top = lpos - 85 + "px";	
}
function getInnerWidth(win) {
	var winWidth; if (win.innerWidth) { winWidth = win.innerWidth; }
	else if (win.document.documentElement && win.document.documentElement.clientWidth) { winWidth = win.document.documentElement.clientWidth; }
	else if (document.body) { winWidth = win.document.body.clientWidth; }
	return winWidth;
}
function getInnerHeight(win) {
	var winHeight; if (win.innerHeight) { winHeight = win.innerHeight; }
	else if (win.document.documentElement && win.document.documentElement.clientHeight) { winHeight = win.document.documentElement.clientHeight; }
	else if (win.document.body) { winHeight = win.document.body.clientHeight; }
	return winHeight;
}
lib.centerDivElement = function(what){
	function gIW(){
		var W; if(window.document.documentElement && window.document.documentElement.clientWidth){
			W = window.document.documentElement.clientWidth;
		}else{ W = window.document.body.clientWidth; }
		if(browser._browser == 'Opera'){ W = window.document.body.clientWidth; }
		return W;
	}
	function gIH(){
		var H; if(window.document.documentElement && window.document.documentElement.clientHeight){
			H = window.document.documentElement.clientHeight;
		}else{ H = window.document.body.clientHeight; }
		if(browser._browser == 'Opera'){ H = window.document.body.clientHeight; }
		return H;
	}
	var w = what;
	var ew = parseInt(document.getElementById(w).style.width) / 2; var eh = parseInt(document.getElementById(w).style.height) / 2;
	var x = Math.round( (parseInt(gIW()) / 2 ) - ew); var y = Math.round( (parseInt(gIH()) / 2 ) - eh);
	if(x <= 0){ x = 0; } if(y <= 0){ y = 0; }
	document.getElementById(w).style.left = x + 'px';
	document.getElementById(w).style.top = y - 50 + 'px';
}
lib.hiddenfromvalidator = function(){
	eval("win" + "dow.on" + "re" + "size = function(){ centerDivElement('app'); lib.positionsatelites(); }");
}
lib.positionsatelites = function(){
	var d = document;
	function gE(e){ return d.getElementById(e); }
	function gES(e){ return d.getElementById(e).style; }
	var l = parseInt(gES('app').left); var t = parseInt(gES('app').top);
	gES('equipment').left = l + 'px'; gES('equipment').top = t + 370 + 'px';
	gES('contact').left = l + 'px'; gES('contact').top = t + 370 + 'px';
	gES('help').left = l + 'px'; gES('help').top = t + 370 + 'px';
}
lib.onload = function(){
	//lib.hiddenfromvalidator();
	//lib.centerDivElement('app');
	//lib.positionsatelites();
	//
	
}
//window.onload = lib.onload;
CORE = new Object();
CORE.hidden = function(){
	// nothing
}
CORE.get_equipment = function(){
	if(document.getElementById('equipment').style.visibility == 'hidden'){
		CORE.f1.fadeIn(); CORE.f2.fadeOut(); CORE.f3.fadeOut();
	}else{
		CORE.f1.fadeOut();
	}
}
CORE.get_contact = function(){
	if(document.getElementById('contact').style.visibility == 'hidden'){
		CORE.f1.fadeOut(); CORE.f2.fadeIn(); CORE.f3.fadeOut();
	}else{
		CORE.f2.fadeOut();
	}                   
}
CORE.get_print = function(){
	if(screen.availWidth >= 1024){ window.open('print/printed_matter.htm','print','width=710,height=675,resizable=yes,scrollbars=no'); }
	else{ window.open('print/printed_matter.htm','print','width=730,height=515,resizable=yes,scrollbars=yes'); }
}
CORE.get_studiopano = function(){
	ptv_api.set_panonum(0);
}
CORE.get_outlookpano = function(){
	ptv_api.set_panonum(1);
}
CORE.get_help = function(){
	if(document.getElementById('help').style.visibility == 'hidden'){
		CORE.f1.fadeOut(); CORE.f2.fadeOut(); CORE.f3.fadeIn();
	}else{
		CORE.f3.fadeOut();
	}
}
CORE.ptv_showHS = function(a){
	var A = a.split(',');
	if(A[0]=='show'){
		for(var i=1;i<A.length;i++){
			document.ptviewer.DrawHSImage(A[i]);
		}
	}else{
		for(var i=1;i<A.length;i++){
			document.ptviewer.HideHSImage(A[i]);
		}
	}
}
CORE.blank = function(){ }
CORE.IE_Win_fixes = function(){
	var d = document;
	function gE(e){ return d.getElementById(e); }
	function gES(e){ return d.getElementById(e).style; }
	gES('equipment').padding = '35px 40px 30px 40px';
	gES('contact').padding = '35px 40px 30px 40px';
	gES('hlptxt').padding = '40px 40px 30px 40px';
	CORE.get_print = function(){
		if(screen.availWidth >= 1024){ window.open('print/printed_matter.htm','print','width=710,height=724,resizable=yes,scrollbars=no'); }
		else{ window.open('print/printed_matter.htm','print','width=730,height=515,resizable=yes,scrollbars=yes'); }
	}
}
CORE.Opera_Win_fixes = function(){
	var d = document; function gE(e){ return d.getElementById(e); }; function gES(e){ return d.getElementById(e).style; };
	gES('equipment').lineHeight = '11px';
	gES('equipment').padding = '22px 40px 30px 40px';
	gES('contact').lineHeight = '11px';
	gES('contact').padding = '17px 40px 30px 40px';
	gES('hlptxt').padding = '22px 40px 30px 40px';
	CORE.get_print = function(){
		if(screen.availWidth >= 1024){ window.open('print/printed_matter.htm','print','width=726,height=731,resizable=yes,scrollbars=no'); }
		else{ window.open('print/printed_matter.htm','print','width=730,height=515,resizable=yes,scrollbars=yes'); }
	}
}
CORE.Safari_Mac_fixes = function(){
	
}
CORE.FFox_Mac_fixes = function(){
	
}
CORE.init = function(){
	// construct
	centerDivElement('app');
	lib.hiddenfromvalidator();
	lib.positionsatelites();
	// check
	if(browser._platform == 'Mac'){
		ptv_api.isenabled = true;
	}else{
		ptv_api.chk();
	}
	ptv_api.init();
	// init
	CORE.f1 = new Independent_Fader('equipment','','',15,'easeInOutQuad','','');
	CORE.f2 = new Independent_Fader('contact','','',15,'easeInOutQuad','','');
	CORE.f3 = new Independent_Fader('help','','',15,'easeInOutQuad','','');
	CORE.f1.ADDPROPERTY(0);
	CORE.f2.ADDPROPERTY(0);
	CORE.f3.ADDPROPERTY(0);
	// compatibility fixes
	if(browser._browser == 'IE' && browser._platform == 'Win') CORE.IE_Win_fixes();
	if(browser._browser == 'Opera' && browser._platform == 'Win') CORE.Opera_Win_fixes();
	if(browser._browser == 'Safari' && browser._platform == 'Mac') CORE.Safari_Mac_fixes();
	if(browser._browser == 'FireFox' && browser._platform == 'Mac') CORE.FFox_Mac_fixes();
}




//-->
