/* Advansys miscellaneous javascript website specific functions */

function EmbedFlash(swf, height, width, loop){
// Main Flash animation - XHTML 1.0 compliant workaround for IE and Firefox (write as javascript rather then embed HTML))
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="main01" width="'+width+'" height="'+height+'">');
document.write('<param name="movie" value="'+swf+'"/>');
document.write('<param name="quality" value="high"/>');
document.write('<param name="base" value="/"/>');
document.write('<param name="loop" value="'+loop+'"/>');
document.write('<embed type="application/x-shockwave-flash" src="'+swf+'" width="'+width+'" height="'+height+'"></embed>');
document.write('</object>');	
}
function ShowMap(MapURL,PostCode){
window.open(MapURL+'&pc='+PostCode,'map','width=700, height=500, scrollbars=yes, location=no, status=yes');
}

var inputs = new Array(0);
var found = new Boolean();

function clinput(input) {
found = false;
for (x in inputs){
	if (inputs[x] == input.name) {
		found = true;
	}
}
	if (found == false)	{
		inputs.push(input.name);
		input.value = '';
	}
}

var t;
var fixedd=0;
var fixedh=0;
function tout()
{
	if (fixedd!=1){
		if (document.getElementById(":1.container")){
			document.getElementById(":1.container").style.display="none";
			fixedd=1;
		}else if (document.getElementById(":0.container")){
			document.getElementById(":0.container").style.display="none";
			fixedd=1;
		}	
		t=setTimeout("tout()",40);
	}else{
		getLanguage();
		var arr1 = document.getElementsByTagName("body");
		for (i = 0; i < arr1.length; i++) {
			arr1[i].setAttribute('style', 'top:0px !important');
		}
	}
}

function relocate(loc) {
	self.location=loc;
}

function ShowTrBar(iCase) {
	getLanguage();
	if (document.getElementById(":1.container")){
		document.getElementById(":1.container").style.display="block";
	}else if (document.getElementById(":0.container")){
		document.getElementById(":0.container").style.display="block";
	}
	if (iCase=='1') {
		var arr1 = document.getElementsByTagName("body");
		for (i = 0; i < arr1.length; i++) {
			arr1[i].setAttribute('style', 'margin-top:40px;');
		}
	}
}

 function getLanguage() {
    result = document.getElementById(":0.targetLanguage").getElementsByTagName("select");
    if (result.length == 1) {
      select = result[0];
      index = select.selectedIndex;
      alert(select[index].value + ':' + select[index].innerHTML);
	  select.selectedIndex=5;
    }
  } 
  
function ClearTranslation() {
	var cookie_date = new Date ( );
	document.cookie = "destLang=notranslate;"; 
	window.location.reload();
}