function DoSearch() {	window.location.href = "/SearchResults?SearchView&Query=" + document.forms['Search'].SearchFor.value + "&SearchFuzzy=TRUE&start=1&Count=25&SearchType=srch"}function DoBrokerSearch(w, h, postcode, town ) {	if (w==undefined) w=550	if (h==undefined) h=750	e = window.open("/BrokerFind/findBroker?openagent&postcode="+ postcode + "&Town=" + town   ,'_new','menubar=no, scrollbars=yes, titlebar=no, toolbar=no, status=yes,width=' + w + ',height=' + h + ',top=20,left=50', false);	var x = (screen.width-w)/2;	var y = (screen.height-h)/2;	e.moveTo(x,y);}function DoStdBrokerSearch( ) {	 w=550	 h=700	e = window.open("/BrokerFind/findBroker?openagent&postcode="+ document.forms['BrokerSearch'].BrokerSearchPostCode.value + "&Town=" + document.forms['BrokerSearch'].BrokerSearchTown.value   ,'_new','menubar=no, scrollbars=yes, titlebar=no, toolbar=no, status=yes,width=' + w + ',height=' + h + ',top=20,left=50', false);	var x = (screen.width-w)/2;	var y = (screen.height-h)/2;	e.moveTo(x,y);}function SendByEmail() {      window.location = "mailto:?subject=Link from Allianz&body=A link from Allianz has been sent to you:%0d%0a%0d%0a" + window.location.href}function showdebug() {	showit = document.getElementById('showdebug')	showit.style.display = ((showit.style.display =='block') ? 'none' : 'block')}function openDUET() {	str = window.location.hostname	iLen = String(str).length;		if (String(str).substring(iLen, iLen - 3) == "dev") {loc = "http://duetdev"}	else {if (String(str).substring(iLen, iLen - 4) == "test") {loc = "http://duettest"}	else {if (String(str).substring(iLen, iLen - 7) == "preview") {loc = "http://duetpreview"}	else {if (str== "cargo") {loc = "http://duet"}	else {if (str== "yachts") {loc = "http://duet"}	else {loc = "https://allianzmarineandaviation.com"}}}}}	winpopup(loc, 950, 675, 'no')}function openDUETDEMO() {	str = window.location.hostname	iLen = String(str).length;		loc = "http://www.allianzduetdemo.co.uk"	winpopup(loc, 950, 675, 'no')}function openECERTS() {	str = window.location.hostname	iLen = String(str).length;	if (String(str).substring(iLen, iLen - 3) == "dev") {loc = "http://ecertsdev"}	else {if (String(str).substring(iLen, iLen - 4) == "test") {loc = "http://ecertstest"}	else {if (String(str).substring(iLen, iLen - 7) == "preview") {loc = "http://ecertspreview"}	else {if (str== "cargo") {loc = "http://ecerts"}	else {if (str== "yachts") {loc = "http://ecerts"}	else {loc = "http://www.allianzcargocertificates.com"}}}}}	winpopup(loc, 950, 675, 'no')}function openDECLAIMS() {	str = window.location.hostname	iLen = String(str).length;	if (String(str).substring(iLen, iLen - 3) == "dev") {loc = "http://declaimsdev"}	else {if (String(str).substring(iLen, iLen - 4) == "test") {loc = "http://declaimstest"}	else {if (String(str).substring(iLen, iLen - 7) == "preview") {loc = "http://declaimstest"}	else {loc = "http://duet"}}}	winpopup(loc, 950, 675, 'no')}/* HOPEFULLY THIS CAN GO AT SOME POINT AS WINPOPUP IS MUCH MORE THOROUGH */function popup(loc, w, h) {	if (w==undefined) w=750	if (h==undefined) h=550	e = window.open(loc,'_new','menubar=no, scrollbars=yes, titlebar=no, toolbar=no, status=yes,width=' + w + ',height=' + h + ',top=20,left=50', false);	var x = (screen.width-w)/2;	var y = (screen.height-h)/2;	e.moveTo(x,y);	}function replaceSubstring(inputString, fromString, toString) {   // Goes through the inputString and replaces every occurrence of fromString with toString   var temp = inputString;   if (fromString == "") {      return inputString;   }   if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)      while (temp.indexOf(fromString) != -1) {         var toTheLeft = temp.substring(0, temp.indexOf(fromString));         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);         temp = toTheLeft + toString + toTheRight;      }   } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop      var midStrings = new Array("~", "`", "_", "^", "#");      var midStringLen = 1;      var midString = "";      // Find a string that doesn't exist in the inputString to be used      // as an "inbetween" string      while (midString == "") {         for (var i=0; i < midStrings.length; i++) {            var tempMidString = "";            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }            if (fromString.indexOf(tempMidString) == -1) {               midString = tempMidString;               i = midStrings.length + 1;            }         }      } // Keep on going until we build an "inbetween" string that doesn't exist      // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string      while (temp.indexOf(fromString) != -1) {         var toTheLeft = temp.substring(0, temp.indexOf(fromString));         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);         temp = toTheLeft + midString + toTheRight;      }      // Next, replace the "inbetween" string with the "toString"      while (temp.indexOf(midString) != -1) {         var toTheLeft = temp.substring(0, temp.indexOf(midString));         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);         temp = toTheLeft + toString + toTheRight;      }   } // Ends the check to see if the string being replaced is part of the replacement string or not   return temp; // Send the updated string back to the user} // Ends the "replaceSubstring" function/* ------------------------------------------------------------------------------     ZEBRA STRIPED TABLE/* ------------------------------------------------------------------------------*/function tableruler() { if (document.getElementById && document.createTextNode) {  var tables=document.getElementsByTagName('table');  for (var i=0;i<tables.length;i++) {   if(tables[i].className=='ruler') {    var trs=tables[i].getElementsByTagName('tr');    for(var j=0;j<trs.length;j++) {     if(trs[j].parentNode.nodeName=='TBODY'  && trs[j].className != 'header' && trs[j].className != 'header1' && trs[j].className != 'colheader' && trs[j].className != 'subheadernoclick') {      if (trs[j].className=='subheader') {       trs[j].onmouseover=function(){this.className='subheader_dn';return false}       trs[j].onmouseout=function(){this.className='subheader';return false}      } else {       trs[j].onmouseover=function(){this.className='ruled';return false}       trs[j].onmouseout=function(){this.className='';return false}       if (j % 2 == 0) trs[j].bgColor = '#EFEFEF';      }     }    }   }  } }}/** * Sets a Cookie with the given name and value. * * name       Name of the cookie * value      Value of the cookie * [expires]  Expiration date of the cookie (default: end of current session) * [path]     Path where the cookie is valid (default: path of calling document) * [domain]   Domain where the cookie is valid *              (default: domain of calling document) * [secure]   Boolean value indicating if the cookie transmission requires a *              secure transmission */function setCookie(name, value, expires, path, domain, secure) {    document.cookie= name + "=" + escape(value) +     	"; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/" +        ((domain) ? "; domain=" + domain : "") +        ((secure) ? "; secure" : "");//        ((expires) ? "; expires=" + expires.toGMTString() : "") +//        ((path) ? "; path=" + path : "") +}/** * Gets the value of the specified cookie. * * name  Name of the desired cookie. * * Returns a string containing value of specified cookie, *   or null if cookie does not exist. */function getCookie(name){	var dc = document.cookie;	var prefix = name + "=";	var begin = dc.indexOf("; " + prefix);	if (begin == -1) {		begin = dc.indexOf(prefix);		if (begin != 0) return null;	} else {		begin += 2;	}	var end = document.cookie.indexOf(";", begin);	if (end == -1) {		end = dc.length;	}	return unescape(dc.substring(begin + prefix.length, end));}/** * Deletes the specified cookie. * * name      name of the cookie * [path]    path of the cookie (must be same as path used to create cookie) * [domain]  domain of the cookie (must be same as domain used to create cookie) */function deleteCookie(name, path, domain) {	if (getCookie(name)) {		document.cookie = name + "=" + 			((path) ? "; path=" + path : "") +			((domain) ? "; domain=" + domain : "") +			"; expires=Thu, 01-Jan-70 00:00:01 GMT";	}}/* ------------------------------------------------------------------------------     ALLOWS LANGUAGE SWITCHING/* ------------------------------------------------------------------------------*/function setlanguage(lang) {	setCookie("language", lang)	document.location.href = document.location.href	window.location.reload(false)}/* ------------------------------------------------------------------------------     USED WITH SHOWSUB ON HEADER/* ------------------------------------------------------------------------------*/var timerID = null; var timecount = 1000;function startrestore() {  if (timerID == null) { timerID=setTimeout( 'restoresub()' , timecount);  timerOn = true;  }  }function cancelrestore() { window.clearTimeout(timerID); timerID = null; }function MM_showHideLayers() { //v6.0  var i,p,v,obj,args=MM_showHideLayers.arguments;  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }    obj.visibility=v; }}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;}var win = null;function winpopup(url, w, h, scroll, status){	w = (w) ? w : 750;	h = (h) ? h : 550;	scroll = (scroll) ? scroll : 'yes';	status = (status) ? status : 'yes';		LeftPosition = (screen.width) ? (screen.width-w)/2 : 50;	TopPosition = (screen.height) ? (screen.height-h)/2 : 20;			settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+ scroll +', resizable=no, menubar=no, titlebar=no, toolbar=no, status=' + status		var now = new Date();	var hms = now.getHours() + "_" + now.getMinutes() + "_" + now.getSeconds();		newwindow = window.open(url, hms, settings)		if (window.focus) newwindow.focus()		/*	if (fullscreen) {		window.moveTo(0,0);		if (document.all) {			top.window.resizeTo(screen.availWidth,screen.availHeight);		} else if (document.layers||document.getElementById) {			if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth) {				top.window.outerHeight = screen.availHeight;				top.window.outerWidth = screen.availWidth;			}		}	}*/}
