var language = location.search.substr(1);
var separator = language.indexOf("&");
if (separator != -1) {
	language = location.search.substring(1, separator+1);	
	warp = location.search.substr(separator+2);
} else {
	warp = 0
}

if (language != "esp" && language != "en") {
   	language="esp";
}
printFlash = function (name, w, h) {		
	if (w == null) {
		w = 1024
	}
	if (h == null) {
		h = 768;
	}
	var html = "";
	html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+w+'" height="'+h+'" id="'+name+'" align="middle">';
	html += '<param name="movie" value="'+name+'.swf" />';
	html += '<param name="FlashVars" value="currentlanguage='+language+'&warp='+warp+'" />';
	html += '<param name="quality" value="high" />';
	html += '<param name="scale" value="noscale" />';
	html += '<embed scale="noscale" src="'+name+'.swf" quality="high" width="'+w+'" height="'+h+'" name="'+name+'"'
	html += ' FlashVars="currentlanguage='+language+'&warp='+warp+'" '
	html += 'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	html += '</object>';
	//
	document.write(html);
}

launch = function (ref) {
	//alert(ref);	
	var test = (ref.indexOf("index.") == -1) || (ref.indexOf("/html/index.html")!=-1);
	if (test) {
		//alert('ttt '+(navigator.userAgent));				
		// Mozilla support 
		if ((navigator.userAgent).indexOf("Gecko") != -1)
		{
			ref = ref.substring(0,ref.indexOf(".html"))+'Short'+ref.substring(ref.indexOf(".html"));
			//alert('Mozilla ' + ref);
			var w = 1010;
			var h = 702;
			var px = Math.round((window.screen.width-w)/2);
			var py = 0;
			window.open(ref, "main", "width="+w+",height="+h+",status=no,scrollbars=no,left="+px+",top="+py);
	  }
	  else // we suppose that this is IE and check for XP SP2
	  {
			if (((navigator.userAgent).indexOf("SV1") != -1) ||((navigator.userAgent).indexOf("IE 7.") != -1))
			{
				ref = ref.substring(0,ref.indexOf(".html"))+'Short'+ref.substring(ref.indexOf(".html"));
				var w = 1010;
				var h = 721;
				var px = Math.round((window.screen.width-w)/2);
				var py = 0;
				if ((window.screen.height == 768)&& (window.screen.width == 1024)){
					window.open(ref, "main", "fullscreen=yes,scrollbars=no,resizable=false");
				}else{
					window.open(ref, "main", "width="+w+",height="+h+",status=yes,scrollbars=no,left="+px+",top="+py);
				}		
			}
    else
    {
		  window.open(ref, "main", "fullscreen=yes");
		}
		}

} else {
		//alert(ref);
		ref = ref.substring(0,ref.indexOf(".html"))+'2'+ref.substring(ref.indexOf(".html"));
		//alert(ref);
		if (window.opener) {
			if (window.opener.closed) {
				var w = 828;
				var h = 600;
				var px = Math.round((window.screen.width-w)/2);
				var py = 0;
				window.open("../"+ref, "language", "width="+w+",height="+h+",toolbar=yes,titlebar=yes,scrollbars=no,status=yes,location=yes,resizable=yes,menubar=yes,left="+px+",top="+py);
				window.close();
			} else {
				window.opener.focus();
				window.close();
			}
		} else {
				var w = 828;
				var h = 621;
				var px = Math.round((window.screen.width-w)/2);
				var py = Math.round((window.screen.height-h)/2)-75;
				window.open("../"+ref, "language", "width="+w+",height="+h+",toolbar=yes,titlebar=yes,scrollbars=yes,status=yes,location=yes,resizable=yes,menubar=yes,left="+px+",top="+py);
				window.close();
		}
	}
}