<!--

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_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_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_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 swapClass(id,thisClass){
	if(document.all||document.getElementById){
		document.getElementById(id).className = thisClass;	
	} else {
		id.className = thisClass;
	}
}

function limitTextArea(form,field,limit){
	var thisField = document.forms[form][field];
	if(thisField.value.length > limit){
		thisField.value = thisField.value.slice(0, limit);
		thisField.focus();
	}
}

function makeNumeric(form,field){
	var thisField = document.forms[form][field];
	if(thisField.value != ""){
		if(isNaN(thisField.value)){
			thisField.value = thisField.value.slice(0, (thisField.value.length - 1));
			thisField.focus();
		}
	} else {
		thisField.value = "";
	}
}

function ShowAlert(title, alert_text){
	var text = title + "\n";
	text += "----------------------------------------------------------------\n";
	text += alert_text + "\n";
	alert(text);
	return false;
}

function Confirm(title, confirm_text, url){
	var text = title + "\n";
	text += "----------------------------------------------------------------\n";
	text += confirm_text + "\n";
	text += "----------------------------------------------------------------\n";
	var doublecheck = confirm(text);
	if(doublecheck != true){
		return false;
	} else {
		document.location = url
	}
}

function showTariff(id){
	
	var intWidth = 0;
	var intHeight = 0;
	var intDivWidth = 300;
	var intDivHeight = 300;
	var intTop = 0;
	var intLeft = 0;
				
	if (navigator.userAgent.indexOf("MSIE") > 0) {
		intWidth = document.body.clientWidth;
		intHeight = document.body.clientHeight;
	} else {
		intWidth = window.outerWidth;
		intHeight = window.outerHeight;
	}
	intTop = ((intHeight - intDivHeight) / 2);
	intLeft = ((intWidth - intDivWidth) / 2);
	
	for (i = 0; i < arrTariffs.length; i++){
		if (document.all||document.getElementById){
			obj = document.getElementById("tariff_" + arrTariffs[i])
		} else {
			obj = MM_findObj("tariff_" + arrTariffs[i])
		}
		if (obj != null){
			if (parseInt(arrTariffs[i]) == parseInt(id)){
				v = "show";
				d = "";
			} else {
				v = "hide";
				d = "none";
			}
		}
		if (obj.style){
			obj=obj.style;
			v=(v=='show')?'visible':(v='hide')?'hidden':v;
			obj.visibility=v;
			obj.display=d;
			obj.widt =intDivWidth;
			obj.height=intDivHeight;
			obj.top=intTop;
			obj.left=intLeft;
		}
	}
}

function hideTariff(){
	for (i = 0; i < arrTariffs.length; i++){
		if (document.all||document.getElementById){
			obj = document.getElementById("tariff_" + arrTariffs[i])
		} else {
			obj = MM_findObj("tariff_" + arrTariffs[i])
		}
		if (obj != null){
			v = "hide";
			d = "none";
		}
		if (obj.style){
			obj=obj.style;
			v=(v=='show')?'visible':(v='hide')?'hidden':v;
			obj.visibility=v;
			obj.display=d;
		}
	}
}

function checkBillingType(varType){
	if (document.all||document.getElementById){
		obj = document.getElementById("dd_fields")
	} else {
		obj = MM_findObj("dd_fields")
	}
	if (obj != null){
		v = "hide";
		d = "none";
		if (parseInt(varType) == 1){
			v = "show";
			d = "";	
		}
	}
	if (obj.style){
		obj=obj.style;
		v=(v=='show')?'visible':(v='hide')?'hidden':v;
		obj.visibility=v;
		obj.display=d;
	}
}

function Processing(form,button){

	var thisButton = document.forms[form][button];
	thisButton.value = "Please Wait..";
	thisButton.disabled = true;
	return true;

}

function checkTicketType(request_type_id){
	var strText;
	switch (request_type_id){
		case "0":
			strText = "Please select a request type";
			break;
		case "1": //customer service
			strText = "All customer enquiries/faults will be looked at as soon as possible (Monday - Friday, 9am - 5:30pm)";
			break;
		case "2": // commercial
			strText = "For commercial enquiries you will be contacted shortly by our commercial team (Monday - Friday, 9am - 5:30pm)";
			break;
		case "3": // emergency
			strText = "For all emergency related enquiries your ticket will be given immediate attention.";
	}
	if (document.all||document.getElementById){
		obj = document.getElementById("request_text")
	} else {
		obj = MM_findObj("request_text")
	}
	obj.innerHTML = strText;		
}

function GoWindowURL(url, name){
	var strWindowURL = url
	var intWidth = 0;
	var intHeight = 0;
				
	if (navigator.userAgent.indexOf("MSIE") > 0) {
		intWidth = document.body.clientWidth;
		intHeight = document.body.clientHeight;
	} else {
		intWidth = window.outerWidth;
		intHeight = window.outerHeight;
	}
	var intTop = 0;
	var intLeft = 0;
	var intResize  = 1; //0 = position specified above : 1 = dynamically positioned
	var intWindowWidth = 800;
	var intWindowHeight = 450;
	if(intResize == 1){
		intTop = ((intHeight - intWindowHeight) / 2);
		intLeft = ((intWidth - intWindowWidth) / 2);
	} else {
		intTop = 0;
		intLeft = 0;
	}
	var strWindowName = name;
	var strOptions = "toolbar=0" +
	",directories=0" +
	",status=0" +
	",menubar=0" +
	",resizable=no" +
	",scrollbars=yes" +
	",width=" + intWindowWidth +
	",height=" + intWindowHeight +
	",top=" + intTop +
	",left=" + intLeft;
	win2 = window.open(strWindowURL,strWindowName,strOptions);
	win2.focus();
}

function GoURL(strURL) {
	document.location.href = strURL;
}

function GoBack(){
	history.go(-1);
}

//-->
