
//-->

function overlayHeight () {
	var scr_h = $(document).height();
	var win_h = 0;
	
	if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    win_h = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    win_h = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    win_h = document.body.clientHeight;
  }
	
	if (scr_h > win_h) {
		document.getElementById('fade').style.height = scr_h + 'px';
	}else{
		document.getElementById('fade').style.height = win_h + 'px';
	}
}


function formPosition(id) {
	var myHeight = 0;
	var myWidth = 0;
	var formTop;
	var formLeft;
	var PopWidth = 540 // document.getElementById(id).clientWidth;
	var PopHeight = 400 // document.getElementById(id).clientHeight;
	
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight );	
	
//<--
	if (myWidth > PopWidth){
		if (myHeight > PopHeight){
			formTop = (myHeight - PopHeight) / 2;
			formLeft = (myWidth - PopWidth) / 2;
			}
		else{
			formTop = 0;
			formLeft = (myWidth - PopWidth) / 2;
			}
	}else{
		if (myHeight > PopHeight){
			formTop = (myHeight - PopHeight) / 2;
			formLeft = 0;
			}
		else{
			formTop = 0;
			formLeft = 0;
			}
	}
	
	document.getElementById(id).style.top = formTop + 'px';
	document.getElementById(id).style.left = formLeft + 'px';
}


function selectpop() {
	document.getElementById('productdetailpop').style.display='block';
	document.getElementById('fade').style.display='block'; 
	overlayHeight();
	formPosition('productdetailpop');
}

function selectpop2() {
	document.getElementById('product-pop2').style.display='block';
	document.getElementById('fade').style.display='block'; 
	overlayHeight();
	formPosition('product-pop2');
}

function selectpop3() {
	document.getElementById('product-pop2').style.display='block';
	document.getElementById('fade').style.display='block'; 
	overlayHeight();
	formPosition('product-pop2');
}

function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}

