var shotWidth = 780;//screen.availshotWidth//1024;
var shotHeight = 600;//screen.availHeight//768;

var screenW=screen.availWidth;
var screenH=screen.availHeight;

var newX = (screen.availWidth - shotWidth)/2;
var newY = (screen.availHeight - shotHeight)/2;

var openedWin;

function getById(id) {
  if (document.all) {
    return document.all[id];
  } else {
    return document.getElementById(id);
  }
}

function showShot(shotId) { 
	alert("shot: " + shotWidth + "x" + shotHeight);
	shot = window.open('i/sshots/'+shotId,'Screenshot','status=no,toolbar=no,scroll=no,location=no,resizable=yes,width='+(shotWidth-10)+',height='+(shotHeight-34));
	
	openedWin = shot;
	
	shot.width = shotWidth-10;
	shot.height = shotHeight-34;
	shot.focus();
	shot.moveTo(newX,newY);
	return false;
}

function showShotFromProductPage(shotId) { 
	//alert("shot: " + shotWidth + "x" + shotHeight + ", " + newX + ", " + newY);
	shot = window.open("../../i/sshots/"+shotId,'Screenshot',"width="+(shotWidth-10)+",height="+(shotHeight-34)+",left=400,top=200,status=0,toolbar=0,scroll=0,location=1,resizable=1");

	openedWin = shot;
	
	shot.resizeTo(shotWidth, shotHeight);
	setTimeout(centerWindow, 100);

	return false;
}

function centerWindow(){
	var win = openedWin;
	var newX = (screen.availWidth - shotWidth)/2;
	var newY = (screen.availHeight - shotHeight)/2;
	
	win.moveTo(newX,newY);
	win.focus();
}

function showLocationDependentMenu(){
	if (window.location.hash == "#MyLifeApplicationMenu"){
		getById("menu-level1-myLifeApplication").style.display="block";
		getById("menu-level2-myLifeApplication").style.display="block";
	}
	if (window.location.hash == "#MyLifeMotivatorMenu"){
		getById("menu-level1-myLifeMotivator").style.display="block";
		getById("menu-level2-myLifeMotivator").style.display="block";
	}
	if (window.location.hash == "#OneAlertMenu"){
		getById("menu-level1-OneAlert").style.display="block";
		getById("menu-level2-OneAlert").style.display="block";
	}
	//window.location.hash="#top";
}

/*function checkEmail(str){
	if(str=="" || str = undefined || str.substr("@")<1){
		return false;
	} 
}*/