var flashMovieMinHeight = 700;

// Function to open help
function openIntro(obj){
	leftVal = (screen.width - 790)/ 2;
	topVal = (screen.height - 475)/ 2;
window.open(obj.path,'mywindow','width=790,left='+leftVal+',top='+topVal+',height=475');
}
function openWindow(obj){
	leftVal = (screen.width - 790)/ 2;
	topVal = (screen.height - 475)/ 2;
window.open('previewAction.do'+obj.js+'?cmd=setparams&designNum='+obj.desID+'&colorNum='+obj.col+'&keyvisualNum='+obj.kv+'&navigationNum='+obj.nav+'&standalone=1','mywindow','width=790,left='+leftVal+',top='+topVal+',height=475');
}

function SUlink(link,js){
	leftVal = (screen.width - 1007)/ 2;
	topVal = (screen.height - 726)/ 2;
//window.open(link,'mywindow','width=1007,left='+leftVal+',top='+topVal+',height=726');
window.open("previewImageAction.do"+js+"?path="+link,'mywindow','width=1007,left='+leftVal+',top='+topVal+',height=726');
}

function closeWindow(){
	window.close();
}

function AskPassword()
	{
	  var pass=prompt("Please enter password for this page","");
  	  if (pass!=null && pass!="")
	    {
		alert('pass: '+pass);
		return pass;
	    }
	  else
	    {
	    return "";
	    }	
	}

function OpenHelp(lang)
	{
	  //alert('lang='+lang);
	  var link = "help/en_GB/index.html"; // default language is English
	  if (lang == "de_DE")
	  	{
		    link = "help/de_DE/index.html";
		} 
	  if (lang == "fr_FR")
	  	{
		    link = "help/fr_FR/index.html";
		}
	  if (lang == "en_GB")
	  	{
		    link = "help/en_GB/index.html";
		} 
	window.open(link, "help", "scrollbars=yes,status=no,toolbar=no,resizable=yes,menubar=no,height=600,width=450")
	}

	
function insertFlash(jsession,state,typeofcontract){
  	if (state == undefined || state == "")
  		{
		    state="editor";
		}
	if (typeofcontract == undefined || typeofcontract == "")
  		{
		    typeofcontract="demo";
		}
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="flashControl" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" style="width: 100%; height: 100%" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="SeamlessTabbing" value="false"/><param name="FlashVars" value="jsessionid='+jsession+'&new=true&loaderState='+state+'&typeofcontract='+typeofcontract+'" /><param name="movie" value="index.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed id="flashControlEmbed" src="index.swf" flashvars="jsessionid='+jsession+'&new=true&loaderState='+state+'&typeofcontract='+typeofcontract+'" quality="high" bgcolor="#ffffff" style="min-width: 1016px; min-height: 700px; width: 100%; height: 100%" align="middle" allowScriptAccess="sameDomain" SeamlessTabbing="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
}

function setFlashSize() {
	var browser=navigator.appName;
	var bodyWidth = document.body.clientWidth;
	var bodyHeight = document.body.clientHeight;
	//var bodyHeight = window.height;
	var flashControl = document.getElementById("flashControl");
	var flashControlEmbed = document.getElementById("flashControlEmbed");
	
	if (bodyWidth > 1016) {
		flashControl.style.width = "100%";
		if (browser!="Microsoft Internet Explorer")
			flashControlEmbed.style.width = "100%";
	}else {
		flashControl.style.width = "1016px";
		if (browser!="Microsoft Internet Explorer")
			flashControlEmbed.style.width = "1016px";
	}
	
	if (bodyHeight > flashMovieMinHeight) {
		flashControl.style.height = "100%";
		if (browser!="Microsoft Internet Explorer")
			flashControlEmbed.style.height = "100%";
		
	}else {
		flashControl.style.height = flashMovieMinHeight;
		if (browser!="Microsoft Internet Explorer")
			flashControlEmbed.style.height = flashMovieMinHeight;
	}
}


function changeMinHeight(h){
	h = parseInt(h);
	//alert('setting min size: '+h);
	flashMovieMinHeight = (h<700) ? 700 : h;
	setFlashSize();
}
