function flipBio(id) {
	var count = 5;
	for (i=1; i<=count; i++) {
		if (i == id) {
			document.getElementById("bio"+i).style.display="block";
			document.getElementById("bioLink"+i).setAttribute("class", "linklistActive");
			document.getElementById("bioLink"+i).className = "linklistActive";
		} else {
			document.getElementById("bio"+i).style.display="none";
			document.getElementById("bioLink"+i).setAttribute("class", "linklist");
			document.getElementById("bioLink"+i).className = "linklist";
		}
	}
}

// Get language so misc phrases can be appropriately translated
var lang;
var ecm = readCookie('ecm');
if (ecm) {
	var lang = ecm.split('&');
	lang = lang[16].substring(13);
} else {
	lang = 1033;
}

// Translations for all phrases in JS
var phrase1 = 'Email address is blank or invalid.';
var phrase2 = 'Phone is required.';
var phrase3 = 'Close';
var phrase4 = 'E-mail';
var phrase5 = 'Phone';
switch(lang) {
	case "2052": //Chinese (simplified)
		phrase1 = '电子邮箱地址是空白的或错误的。';
		phrase2 = '请留下电话 ';
		phrase3 = '关闭';
		phrase4 = '电子邮箱';
		phrase5 = '电话';
		break;
	case "1028": //Chinese (traditional)
		phrase1 = '電子郵箱位址是空白的或錯誤的。';
		phrase2 = '請留下電話 ';
		phrase3 = '關閉';
		phrase4 = '電子郵箱';
		phrase5 = '電話';
		break;
	case "2057": //British
		phrase1 = 'Email address is blank or invalid.';
		phrase2 = 'Phone is required.';
		phrase3 = 'Close';
		phrase4 = 'E-mail';
		phrase5 = 'Phone';
		break;
	case "1036": //French
		phrase1 = 'Adresse E-mail incomplete ou invalide.';
		phrase2 = 'Téléphone requis.';
		phrase3 = 'Fermer';
		phrase4 = 'E-mail';
		phrase5 = 'Téléphone';
		break;
	case "1031": //German
		phrase1 = 'Bitte geben Sie eine gültige E-Mail-Adresse an.';
		phrase2 = 'Bitte geben Sie Ihre Telefonnummer an.';
		phrase3 = 'Schliessen';
		phrase4 = 'E-Mail-Adresse';
		phrase5 = 'Telefonnummer';
		break;
	case "1040": //Italian
		phrase1 = '';
		phrase2 = '';
		phrase3 = '';
		phrase4 = '';
		phrase5 = '';
		break;
	case "1041": //Japanese
		phrase1 = 'メールアドレスが空欄もしくは無効';
		phrase2 = '電話必要';
		phrase3 = '閉じる';
		phrase4 = 'メール';
		phrase5 = '電話';
		break;
	case "1042": //Korean
		phrase1 = '이메일 주소가 빠졌거나 유효하지 않습니다.';
		phrase2 = '전화번호가 필요합니다.';
		phrase3 = '닫기';
		phrase4 = '이-메일';
		phrase5 = '전화';
		break;
	case "1034": //Spanish
		phrase1 = 'La dirección de email está en blanco o no es válida.';
		phrase2 = 'Número de teléfono obligatorio.';
		phrase3 = 'Cerrar';
		phrase4 = 'E-mail';
		phrase5 = 'Teléfono';
		break;
}

function anchorShadow() {
	document.getElementById('bottomShadow').style.position='absolute';
	document.getElementById('bottomShadow').style.bottom='0';
}

function randomPhoto(category,count) {
	random_num = Math.floor(Math.random()*count+1);
	document.write('<img src="/images/footer/' + category + '_' + random_num + '.jpg" width="100" height="80" border="0" alt="" />');
}

function moveit() {
	//Replace spaces in filename and place it in visible textfield
	document.getElementById('filename').value = document.getElementById('ctl00_Middle_file1').value.replace(/ /g,"_");
	document.getElementById('filename2').value = path + document.getElementById('ctl00_Middle_file1').value.replace(/ /g,"_");
}

function setHidden(clicked, hidden) {
	if (document.getElementById(clicked).checked) {
		document.getElementById(hidden).value = "yes";
	} else {
		document.getElementById(hidden).value = "";
	}
}

function setChart(category,alloys) {
	 //<![CDATA[
	var chart = new AnyChart('/flash/AnyChart.swf');
	//chart.width = 960;
	//chart.height = 560;
	if (category == 'melting') {
		chart.setXMLFile('/casting/melting.aspx?alloy=' + alloys);
	} else {
		chart.setXMLFile('/casting/anychart.aspx?category=' + category + '&alloy=' + alloys);
	}
	chart.write('hiddenModalContent');
	//]]>
}

// retrieve value of query string
function querySt(ji) {
	hu = window.location.search.substring(1);
	gy = hu.split("&");
	for (i=0;i<gy.length;i++) {
		ft = gy[i].split("=");
		if (ft[0] == ji) {
			return ft[1];
		}
	}
}

// toggle validation on email/phone
function setValidation(id) {
	// retrieve current form values
	var emailValue,phoneValue;
	emailValue = document.getElementById('Email').value;
	phoneValue = document.getElementById('Phone').value;
	
	if (id == 1) {
		document.getElementById('fieldEmail').innerHTML = '<span class="blue">*</span> ' + phrase4;
		document.getElementById('fieldPhone').innerHTML = phrase5;
		
		document.getElementById('inputEmail').innerHTML = '<input style="width: 242px;" onblur="design_validate_re(/^([A-Za-z0-9!#-\'\*\+\-\/=\?\^_`\{-~]+(\.[A-Za-z0-9!#-\'\*\+\-\/=\?\^_`\{-~]+)*@[A-Za-z0-9!#-\'\*\+\-\/=\?\^_`\{-~]+(\.[A-Za-z0-9!#-\'\*\+\-\/=\?\^_`\{-~]+)*)$/,this,\'' + phrase1 + '\');" ektdesignns_invalidmsg="' + phrase1 + '" ektdesignns_schema="&lt;xs:pattern value=&quot;[A-Za-z0-9!#-\'\*\+\-\/=\?\^_`\{-~]+(\.[A-Za-z0-9!#-\'\*\+\-\/=\?\^_`\{-~]+)*@[A-Za-z0-9!#-\'\*\+\-\/=\?\^_`\{-~]+(\.[A-Za-z0-9!#-\'\*\+\-\/=\?\^_`\{-~]+)*&quot; /&gt;" ektdesignns_basetype="text" ektdesignns_datatype="string" ektdesignns_validation="email-req" ektdesignns_nodetype="element" ektdesignns_validate="re:/^([A-Za-z0-9!#-\'\*\+\-\/=\?\^_`\{-~]+(\.[A-Za-z0-9!#-\'\*\+\-\/=\?\^_`\{-~]+)*@[A-Za-z0-9!#-\'\*\+\-\/=\?\^_`\{-~]+(\.[A-Za-z0-9!#-\'\*\+\-\/=\?\^_`\{-~]+)*)$/" ektdesignns_name="Email" ektdesignns_caption="Email" id="Email" name="Email" type="text" />';
		document.getElementById('inputPhone').innerHTML = '<input style="width: 242px;" ektdesignns_caption="Phone" ektdesignns_name="Phone" ektdesignns_nodetype="element" name="Phone" id="Phone" ektdesignns_datatype="string" ektdesignns_basetype="text" type="text" />';
	} else {
		document.getElementById('fieldEmail').innerHTML = phrase4;
		document.getElementById('fieldPhone').innerHTML = '<span class="blue">*</span> ' + phrase5;
		
		document.getElementById('inputEmail').innerHTML = '<input style="width: 242px;" ektdesignns_caption="Email" ektdesignns_name="Email" ektdesignns_nodetype="element" name="Email" id="Email" ektdesignns_datatype="string" ektdesignns_basetype="text" type="text" />';
		document.getElementById('inputPhone').innerHTML = '<input type="text" style="width: 242px;" name="Phone" ektdesignns_nodetype="element" ektdesignns_name="Phone" ektdesignns_caption="Phone" id="Phone" ektdesignns_datatype="string" ektdesignns_basetype="text" ektdesignns_schema="&lt;xs:minLength  value=&quot;1&quot;/&gt;" ektdesignns_invalidmsg="' + phrase2 + '" onblur="design_validate_re(/\S+/,this,\'' + phrase2 + '\');" />';
		//ektdesignns_validate="re:/\S+/" ektdesignns_validation="string-req" 
	}
	
	// set form values after input boxes are replaced
	document.getElementById('Email').value = emailValue;
	document.getElementById('Phone').value = phoneValue;
}

// toggle short and long versions of each description
function toggleContent(id) {
	if (document.getElementById('content' + id + '_short').style.display == 'none') {
		document.getElementById('content' + id + '_short').style.display = '';
		document.getElementById('content' + id).style.display = 'none';
	} else {
		document.getElementById('content' + id + '_short').style.display = 'none';
		document.getElementById('content' + id).style.display = '';
	}
}

// open close nav items
function toggleNav(id,max) {
	for (var i=1; i<=max; i++) {
		if (i != id) {
			document.getElementById("category"+i).className='side';
			document.getElementById("section"+i).style.display='none';
		} else {
			document.getElementById("category"+i).className='blue';
			document.getElementById("section"+i).style.display='';
		}
	}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.1
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
	if (val) { args[i+1]=='' ? nm=val.name : nm=args[i+1]; if ((val=val.value)!="") {
	  if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
		if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
	  } else if (test!='R') { num = parseFloat(val);
		if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
		if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
		  min=test.substring(8,p); max=test.substring(p+1);
		  if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
	} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

var replaceQueryString = ""
function BuildQueryString() {
    replaceQueryString = ""
    var search;
    try {search = location.href.split("?");} catch(err) {search='';} 
    if (search.length > 1){ 
        var vals=search[1].split("&");
        var request= new Array(); 
        for (var i in vals) { 
            vals[i] = vals[i].replace(/\+/g, " ").split("="); 
            if (unescape(vals[i][0]).toLowerCase() != "langtype") { //we just ignore langtype.
                if (replaceQueryString == "") { replaceQueryString = unescape(vals[i][0]) + "=" + unescape(vals[i][1]) } 
                else { replaceQueryString += "&" +  unescape(vals[i][0]) + "=" + unescape(vals[i][1])}
            }
            request[unescape(vals[i][0])] =unescape(vals[i][1]); 
        }
    }
}
BuildQueryString();

function LoadSiteLanguage(obj) {
  //clear region cookie
  Delete_Cookie('region','/');
	
  BuildQueryString();
  if (replaceQueryString != "") { replaceQueryString = replaceQueryString + "&" } 
  var path = '';
  try {path = location.pathname} catch(err) {} 
  
  // set cookie
  lang = obj.options[obj.selectedIndex].value;

  //document.cookie='ecm=user_id=0&site_id=&username=&new_site=/&unique_id=0&site_preview=0&langvalue=0&DefaultLanguage=' + lang + '&NavLanguage=' + lang + '&LastValidLanguageID=' + lang + '&ContType=&UserCulture=' + lang + '&SiteLanguage=' + lang + '';
  //document.cookie='ecm=user_id=0&site_id=&userfullname=&displayname=&username=&new_site=/&unique_id=0&editoroptions=&site_preview=0&langvalue=&isMembershipUser=0&pagesize=50&last_login_date=&dm=www.dynacast.com&DefaultLanguage=' + lang + '&NavLanguage==' + lang + '&SiteLanguage==' + lang + '&DefaultCurrency=840&SiteCurrency=840&template=&folderid=&width=900&height=580&FolderPath=&DisplayBorders=1&DisplayTitleText=1&UserCulture=' + lang + '&LastValidLanguageID=' + lang + '&ContType=-1'
  //redirect
  path = path + "?" + replaceQueryString + "LangType=" + obj.options[obj.selectedIndex].value;
  path = path.replace("//", "/");
  document.location.href= path;
 
}

function changecss(theClass,element,value) {
 var cssRules;
 if (document.all) {
  cssRules = 'rules';
 } else if (document.getElementById) {
  cssRules = 'cssRules';
 }
 var added = false;
 for (var S = 0; S < document.styleSheets.length; S++) {
  if(!added){
  if(document.styleSheets[S].insertRule) {
	  document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',document.styleSheets[S][cssRules].length);
	} else if (document.styleSheets[S].addRule) {
		document.styleSheets[S].addRule(theClass,element+': '+value+';');
	}
  }
 }
}

// with this test document.cookie.indexOf( name + "=" );
function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );


		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

/**
 * SWFObject v1.4.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
deconcept.SWFObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey, bypassKey){
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.BYPASS_KEY = bypassKey ? bypassKey : 'bypass';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.skipFlash = deconcept.util.getRequestParameter(this.BYPASS_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', useExpressInstall);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs.push(key +"="+ variables[key]);
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "PlugIn"); }
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "ActiveX"); }
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}

		if(this.skipFlash != 'true' && (this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version')))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else{
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		if(q) {
			var pairs = q.substring(1).split("&");
			for (var i=0; i < pairs.length; i++) {
				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
					return pairs[i].substring((pairs[i].indexOf("=")+1));
				}
			}
		}
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	if (window.opera || !document.all) return;
	var objects = document.getElementsByTagName("OBJECT");
	for (var i=0; i < objects.length; i++) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
// fixes bug in fp9 see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
deconcept.SWFObjectUtil.prepUnload = function() {
	__flash_unloadHandler = function(){};
	__flash_savedUnloadHandler = function(){};
	if (typeof window.onunload == 'function') {
		var oldUnload = window.onunload;
		window.onunload = function() {
			deconcept.SWFObjectUtil.cleanupSWFs();
			oldUnload();
		}
	} else {
		window.onunload = deconcept.SWFObjectUtil.cleanupSWFs;
	}
}
if (typeof window.onbeforeunload == 'function') {
	var oldBeforeUnload = window.onbeforeunload;
	window.onbeforeunload = function() {
		deconcept.SWFObjectUtil.prepUnload();
		oldBeforeUnload();
	}
} else {
	window.onbeforeunload = deconcept.SWFObjectUtil.prepUnload;
}
/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;

function checkKeycode(e) {
          	
               var keycode;
               if (window.event) // IE
                    keycode = e.keyCode;
               else if (e.which) // Netscape/Firefox/Opera
                    keycode = e.which;
                    
               if (keycode==13) 
                     
                  CallSearch();
           }
         
           //document.onkeydown = checkKeycode;
function entsub(event,ourform) {
  if (event && event.keyCode == 13) {
    CallSearch();
	return false;
  }else{
    return true;
  }
}
         
function CallSearch()
{

   var objsearchText = document.getElementById('txtSearchText');
   var searchText;
   if ((objsearchText!=null) && (objsearchText.value!='search') && (objsearchText.value!=''))
   {
	   searchText = objsearchText.value;
	   searchText = searchText.replace(/>/gi, " >");
	   searchText = searchText.replace(/</gi, "< ");
	   objsearchText.value = searchText;
	   
		//This cookie is used for the backbutton to work in search on postback
	   //This cookie must be cleared to prevent old search results from displayed
	   document.cookie='postbackcookie=';
	   window.location.href="/search.aspx?searchtext=" + searchText.replace('alert','').replace('confirm','') + "&folderid=0&searchfor=html&orderby=id&orderdirection=ascending";
	   
	   //Load the page with the websearch server control in the bottom frame using Javascript
	   //Set websearch properties using querystring parameters
	   //Properties set here- search text,Orderby, FolderId, and SearchFor
	   //SearchFor can be a value from all/html/documents/images/multimedia/discussionForum
	   //Orderby can be one of these - editor,id,rank,title,datecreated,datemodified
	   //OrderDirection can be ascending or descending
   }
}