
<!-- *************************************************************************** -->
<!-- The Red Fox UK websites, including all text, HTML, scripts, and images      -->
<!-- are copyright 1997 - 2005. All rights reserved.                             -->
<!--                                                                             -->
<!-- Any replication, modification, or copy of any part of this website without  -->
<!-- the prior, written consent of Red Fox UK is prohibited.                     -->
<!--                                                                             -->
<!-- This copyright notice applies to clients, non-clients, affiliates, and      -->
<!-- resellers of Red Fox UK and subsidiaries.                                   -->
<!-- *************************************************************************** -->

<!--
function contact_JumpMenu(targ, selObj, supportURL){
	if(selObj.options[selObj.selectedIndex].value == "Customer Support"){
		eval(targ + ".location = supportURL;");
	}
}

function loadImage(sFilename){
	var img = new Image();
	img.src = "http://www.redfoxhosting.com/images/" + sFilename;
	return img;
}

function getElement(id){
	if(document.getElementById){
		return document.getElementById(id);
	}else if(document.all){
		return document.all(id);
	}else{
		return null;
	}
}

function toggleElementDisplay(elementName) {
	var element = getElement(elementName);
						
	if(element){
		if(element.style.display == "none"){
			element.style.display = "block";
		}else{
			element.style.display = "none";
		}
	}
					
	return true;
}

function copyToClipboard(clipboardText){
	if(window.clipboardData){
		window.clipboardData.setData("Text", clipboardText);
		return true;
	}
	
	return false;
}

function formatCurrency(curAmount){
	// First, round it to 2 places.
	curAmount = roundToXPlaces(curAmount, 2);
	
	// Check to see whether padding of 2 zeros is needed.
	if(curAmount == Math.floor(curAmount)){
		curAmount = curAmount + ".00";
	}else{
		// Check to see whether padding of 1 zero is needed.
		if(curAmount * 10 == Math.floor(curAmount * 10)){
			curAmount = curAmount + "0";
		}
	}
	
	return curAmount;
}


function roundToXPlaces(dblAmount, x){
	x = (!x ? 2: x);
	return Math.round(dblAmount * Math.pow(10, x)) / Math.pow(10, x);
}

function docOnSelect(){
	if(window.event.srcElement.tagName != "INPUT" && window.event.srcElement.tagName != "TEXTAREA"){
		window.event.returnValue = false;
		window.event.cancelBubble = true;
	}
	
	if(window.event.srcElement.allowCopy){
		if(copyToClipboard(window.event.srcElement.innerText)){
			alert("The following data has been placed on your clipboard:" + "\n\r\n\r" + window.event.srcElement.innerText);
		}
	}
}

function docOnContextMenu(){
	if(window.event.srcElement.tagName != "A" && window.event.srcElement.tagName != "INPUT" && window.event.srcElement.tagName != "TEXTAREA"){
		window.event.returnValue = false;
		window.event.cancelBubble = true;
	}
}


document.onselectstart = docOnSelect;
document.oncontextmenu = docOnContextMenu;


function doRand(){
	var num;
	now = new Date();
	num = (now.getSeconds());
	num = num + 1;
	return num;
}

function ShowInfoTip(div, title, desc){
	div.style.display = "inline";
	div.style.position = "absolute";
	div.style.width = "160";
	div.style.backgroundColor = "lightyellow";
	div.style.border = "dashed 1px black";
	div.style.padding = "10px";
	div.innerHTML = "<b>" + title + "</b><br><img src=\"/images/blank.gif\" widthth=\"1\" height=\"5\"><br><div style=\"padding-left: 10px; padding-right: 10px;\">" + desc + "</div>";
}

function HideInfoTip(div){
	div.style.display = "none";
}

function domainPricesOpen(url){
	myWin = window.open("", "winName", "width=500, height=450, status=no, toolbar=no, menubar=no, scrollbars=yes");
	return true;
}

function securityCodeHelpOpen(url){
	myWin = open("", "winName", "width=520, height=400, status=no, toolbar=no, menubar=no, scrollbars=yes");
	return true;
}

function imageViewer(sScript, sType, sImage, sTitle, iWidth, iHeight, bRestricResize){
	if(!sTitle){
		sTitle = "";
	}
	
	if(bRestricResize){
		var sAdditionalOptions = ", resizable=1";
	}else{
		var sAdditionalOptions = ", resizable=0";
	}
	
	var newWin = open(sScript + "?random=" + doRand() + "&type=" + sType + "&file=" + sImage + "&title=" + sTitle + "&width=" + iWidth + "&height=" + iHeight, "imageViewerPopup", "scrollbars=no, width=300, height=50, screenX=150, screenY=150, top=150, left=150" + sAdditionalOptions);
	
	if(newWin.focus){
		newWin.focus();
	}
	
	return false;
}

function disableOrderFormButtons(){
	var btnBack = document.order.back;
	var btnNext = document.order.next;
	
	if(btnBack){
		document.order.back.disabled = true;
		document.order.back.value = document.order.back.value;
	}
	
	if(btnNext){
		document.order.next.disabled = true;
		document.order.next.value = "please wait";
	}
	
	return true;
}

function isJavaInstalled(){
	return navigator.javaEnabled();
}

function trimSpecial(sString, sTrim){
	while(sString.substring(0, 1) == sTrim){
		sString = sString.substring(1, sString.length);
	}
	
	while(sString.substring(sString.length - 1, sString.length) == sTrim){
		sString = sString.substring(0, sString.length - 1);
	}
	
	return sString;
}

function setCookie(cookieName, cookieKey, cookieValue, cookieExpiry){
	if(cookieExpiry){
		var expiry = cookieExpiry
	}else{
		var expiry = null;
	}
	return setCookieEx(cookieName, cookieKey, cookieValue, expiry, null, "redfoxhosting.com");
}

function getCookie(cookieName, cookieKey){
	return getCookieEx(cookieName, cookieKey);
}

function setCookieEx(name, key, value, expires, path, domain, secure){
	if(key){
		var currentKeyVal = getCookie(name, key);
		var currentCookie = getCookie(name, null, true);
		
		if(currentCookie){
			currentCookie = currentCookie.toString();
			currentCookie = currentCookie.replace(key + "=" + currentKeyVal, "");
			currentCookie = currentCookie.replace(key + "=", "");
			
			var newCookie = name + "=" + escape(key) + "=" + escape(value) + "&" + trimSpecial(currentCookie, "&");
		}else{
			var newCookie = name + "=" + escape(key) + "=" + escape(value);
		}
	}else{
		var newCookie = name + "=" + escape(value);
	}
	
	newCookie.toString();
	document.cookie = trimSpecial(newCookie, "&") + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
	return true;
}

function getCookieEx(name, key, nodecode){
	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 = dc.indexOf(";", begin);
	if(end == -1){
		end = dc.length;
	}
	
	var fullCookie = dc.substring(begin + prefix.length, end)
	
	if(key){
		var prefix = key + "=";
		var begin = fullCookie.indexOf(prefix);	
		
		if(begin == -1){
			return null;
		}else{
			var end = fullCookie.indexOf("&", begin);
			
			if(end == -1){
				end = fullCookie.length;
			}
			
			var partCookie = fullCookie.substring(begin + prefix.length, end);
			
			if(partCookie.length <= 0){
				return null;
			}
		}
	}else{
		var partCookie = fullCookie;
	}
	
	if(!nodecode){
		partCookie = unescape(partCookie);
	}
	
	return partCookie;
}

function deleteCookieEx(name, path, domain){
	if(getCookie(name)){
		document.cookie = name + "=" +  ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
	return true;
}

function getXMLHTTP(){
	var objXMLHTTP = null;
	try{
		objXMLHTTP = new ActiveXObject("MSXML2.XMLHTTP");
	}catch(e1){
		try{
			objXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(e2){
			objXMLHTTP = null;
		}
	}
	
	if(!objXMLHTTP && typeof XMLHttpRequest != "undefined"){
		objXMLHTTP = new XMLHttpRequest();
	}
	
	return objXMLHTTP;
}

function disableForm(frmForm, strCustomMessage){
	var oElement = null;
	var oNewElement = null;
	var sElementName = null;
	
	var oElements = frmForm.getElementsByTagName("INPUT");
	var oElementsLength = oElements.length;
	
	for(i = 0; i < oElementsLength; i++){
		oElement = oElements[i];
		sElementName = oElement.name;
		//oElement.name = sElementName + "_DISABLED";
		
		if(oElement.type == "submit"){
			if(strCustomMessage){
				oElement.value = strCustomMessage;
			}else{
				oElement.value = "Please Wait";
				oElement.disabled = true;
			}
		}else if(oElement.type == "button"){
			if(oElement.onclick){
				if(strCustomMessage){
					oElement.value = strCustomMessage;
				}else{
					oElement.value = "Please Wait";
					oElement.disabled = true;
				}
			}
		}else if(oElement.type != "file" && oElement.type != "hidden"){
			oNewElement = document.createElement("INPUT");
			
			if(oElement.type != "checkbox" || oElement.checked){
				if(document.all){
					oNewElement.type = "hidden";
					//oElement.disabled = true;
					oNewElement.name = sElementName;
					oNewElement.value = oElement.value;
					//frmForm.appendChild(oNewElement);
					
				}else if(document.getElementById){
					oNewElement.setAttribute("type", "hidden");
					//oNewElement.setAttribute("disabled", "true");
					oNewElement.setAttribute("name", sElementName);
					oNewElement.setAttribute("value", oElement.value);
					
					//frmForm.appendChild(oNewElement);
				}
			}
		}
	}
	
	return true;
}

function deleteNode(nodeName){
	var targetElement = getElement(nodeName);
	if(targetElement == null){
		return false;
	}else{
		targetElement.style.display = "none";
		removeChildren(targetElement);
		return true;
	}
}

function removeChildren(parentNode){
	if(!parentNode || !parentNode.childNodes){
		return false;
	}
	
	var nodeList = parentNode.childNodes;		
	var node = nodeList[0];
	
	while(node != null){
		parentNode.removeChild(node);
		node = nodeList[0];
	}
}

function goBack(Stage){
	document.location = "/?Stage=" + Stage;
}

function button_confirm(Message){
	if(confirm(Message)){
		return true;
	}else{
		return false;
	}
}

function logoff(){
	ht = document.getElementsByTagName("body");
	ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
	if(confirm("Are you sure you want to log off?")){
		return true;
	}else{
		ht[0].style.filter = "";
		return false;
	}
}

function awardsGradOnloadEvent(){
	var award1 = getElement("award1");
	var award2 = getElement("award2");
	
	if(award1){
		try {
			award1.style.filter = "gray alpha(opacity=30);";
			selAddEvent(award1, "mousemove", fadeIn);
			selAddEvent(award1, "mouseout", fadeOut);
		}catch (e){}
	}
	if(award2){
		try {
			award2.style.filter = "gray alpha(opacity=30);";
			selAddEvent(award2, "mousemove", fadeIn);
			selAddEvent(award2, "mouseout", fadeOut);
		}catch (e){}
	}
}

function creditCardsGradOnloadEvent(){
	var CC_VISA = getElement("CC_VISA");
	var CC_VIED = getElement("CC_VIED");
	var CC_SWIT = getElement("CC_SWIT");
	var CC_SOLO = getElement("CC_SOLO");
	var CC_JCB = getElement("CC_JCB");
	var CC_VISD = getElement("CC_VISD");
	var CC_MSCD = getElement("CC_MSCD");
	var CC_poweredByWorldPay = getElement("CC_poweredByWorldPay");
		
	if(CC_VISA){
		try {
			CC_VISA.style.filter = "gray alpha(opacity=30);";
			selAddEvent(CC_VISA, "mousemove", fadeIn);
			selAddEvent(CC_VISA, "mouseout", fadeOut);
		}catch (e){}
	}
	if(CC_VIED){
		try {
			CC_VIED.style.filter = "gray alpha(opacity=30);";
			selAddEvent(CC_VIED, "mousemove", fadeIn);
			selAddEvent(CC_VIED, "mouseout", fadeOut);
		}catch (e){}
	}
	if(CC_SWIT){
		try {
			CC_SWIT.style.filter = "gray alpha(opacity=30);";
			selAddEvent(CC_SWIT, "mousemove", fadeIn);
			selAddEvent(CC_SWIT, "mouseout", fadeOut);
		}catch (e){}
	}
	if(CC_SOLO){
		try {
			CC_SOLO.style.filter = "gray alpha(opacity=30);";
			selAddEvent(CC_SOLO, "mousemove", fadeIn);
			selAddEvent(CC_SOLO, "mouseout", fadeOut);
		}catch (e){}
	}
	if(CC_JCB){
		try {
			CC_JCB.style.filter = "gray alpha(opacity=30);";
			selAddEvent(CC_JCB, "mousemove", fadeIn);
			selAddEvent(CC_JCB, "mouseout", fadeOut);
		}catch (e){}
	}
	if(CC_VISD){
		try {
			CC_VISD.style.filter = "gray alpha(opacity=30);";
			selAddEvent(CC_VISD, "mousemove", fadeIn);
			selAddEvent(CC_VISD, "mouseout", fadeOut);
		}catch (e){}
	}
	if(CC_MSCD){
		try {
			CC_MSCD.style.filter = "gray alpha(opacity=30);";
			selAddEvent(CC_MSCD, "mousemove", fadeIn);
			selAddEvent(CC_MSCD, "mouseout", fadeOut);
		}catch (e){}
	}
	if(CC_poweredByWorldPay){
		try {
			CC_poweredByWorldPay.style.filter = "gray alpha(opacity=30);";
			selAddEvent(CC_poweredByWorldPay, "mousemove", fadeIn);
			selAddEvent(CC_poweredByWorldPay, "mouseout", fadeOut);
		}catch (e){}
	}
	
	toggleElementDisplay("CC_Row1");
	toggleElementDisplay("CC_Row2");
	toggleElementDisplay("CC_Row3");
}

function swapImage(imgName, sFilename){
	document.images[imgName].src = sFilename;
}

function fadeIn(e){
	if(window.event){
		target = window.event.srcElement;
	}else if(e){
		target = e.target;
	}else{
		return;
	}
	
	target.style.filter = "alpha(opacity=" + target.filters.alpha.opacity + ")";
	nereidFade(target, 100, 1, 5);
}

function fadeOut(e){
	if(window.event){
		target = window.event.srcElement;
	}else if(e){
		target = e.target;
	}else{
		return;
	}
	
	target.style.filter = "gray " + target.style.filter;
	nereidFade(target, 30, 50, 5);
}

function selAddEvent(elm, evType, fn, useCapture){
	if(elm.addEventListener){
		elm.addEventListener(evType, fn, useCapture);
		return true;
	}else if(elm.attachEvent){
		var r = elm.attachEvent("on" + evType, fn);
		return r;
	}
} 

nereidFadeObjects = new Object();
nereidFadeTimers = new Object();

function nereidFade(object, destOp, rate, delta){
	if(!document.all){
		return;
	}
	
	if(object != "[object]"){
		setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")", 0);
		return;
	}
	
	clearTimeout(nereidFadeTimers[object.sourceIndex]);
	
	diff = destOp-object.filters.alpha.opacity;
	direction = 1;
	
	if(object.filters.alpha.opacity > destOp){
		direction = -1;
	}
	
	delta = Math.min(direction * diff, delta);
	object.filters.alpha.opacity += direction * delta;
	
	if(object.filters.alpha.opacity != destOp){
		nereidFadeObjects[object.sourceIndex] = object;
		nereidFadeTimers[object.sourceIndex] = setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")", rate);
	}
}

function openLiveChat(rootURL, SiteID, QueueID){
	var windowWidth = 490;
	var windowHeight = 404;
	var windowLeft = (screen.width - windowWidth) / 2;
	var windowTop = (screen.height - windowHeight) / 2;
	
	var windowSize = "height=" + windowHeight + ",width=" + windowWidth + ",top=" + windowTop + ",left=" + windowLeft;
	var windowLiveChat = window.open(rootURL + "/SightMaxAgentInterface/PreChatSurvey.aspx?siteID=" + SiteID + "&queueID=" + QueueID, "chatWindow", windowSize + ",resizable=0,scrollbars=no,menubar=no,status=no");
	
	if(windowLiveChat){
		windowLiveChat.opener = self;
	}
}

function writeLiveChat(rootURL, SiteID, QueueID){
	document.write("<a href=\"javascript:openLiveChat('" + rootURL + "', '" + SiteID + "', '" + QueueID + "');\" onMouseOut=\"top.status=''; return true;\" onMouseDown=\"top.status='Launch Red Fox UK Live Chat!'; return true;\" onMouseOver=\"top.status='Launch Red Fox UK Live Chat!'; return true;\"><img border=\"0\" src=\"" + rootURL + "/SightMaxAgentInterface/chat.smgif?siteID=" + SiteID + "&queueID=" + QueueID + "\" alt=\"Launch Red Fox UK Live Chat!\"></a>");
}

function escapeText(strURI){
	if(encodeURIComponent){
		return encodeURIComponent(strURI);
	}
	
	if(escape){
		return escape(strURI);
	}
}

function confirmURL(strMessage, strURL){
	if(confirm(strMessage)){
		document.location.href = strURL;
	}
}

function getElementOffsetLeft(eElement){
	var offset = 0;
	var documentElement = eElement;
	
	while(documentElement){
		offset = offset + documentElement["offsetLeft"];
		documentElement = documentElement.offsetParent;
	}
	
	return offset;
}

function getElementOffsetTop(eElement){
	var offset = 0;
	var documentElement = eElement;
	
	while(documentElement){
		offset = offset + documentElement["offsetTop"];
		documentElement = documentElement.offsetParent;
	}
	
	return offset;
}

function isValidDateYMD(txtDate){
	var day, month, year;
	var dateString;
	var indx1, indx2, delimiter;
	dateString = txtDate;
	
	if(dateString.length != 10){
		return false;
	}
	
	if(dateString.indexOf("-") != 4 || dateString.substring(5, dateString.length).indexOf("-") != 2){
		return false;
	}
	
	year = dateString.substr(0, 4);
	month = dateString.substr(6, 2);
	day = dateString.substr(8, 2);
	return isValidDate(day, month, year);
}

function isValidDate(day, month, year){
	if(month < 1 || month > 12){
		return false;
	}
	
	if(day < 1 || day > 31){
		return false;
	}
	
	if((month == 4 || month == 6 || month == 9 || month == 11) && day == 31){
		return false;
	}
	
	if(month == 2){
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		if(day > 29 || (day == 29 && !isleap)){
			return false;
		}
	}
	return true;
}

function isAlphaNumeric(inStr){
	var alphaRegExp = /^[a-zA-Z0-9]*$/;
	return (alphaRegExp.test(inStr));
}

function isValidEmailChars(inStr){
	var emailRegExp = new RegExp("^([A-Za-z0-9])+([A-Za-z0-9_\.\-])+([A-Za-z0-9])+$|^[A-Za-z0-9]{1}|^[A-Za-z0-9]{2}?$");
	return emailRegExp.test(inStr);
}

function isValidEmailAddress(emailAddress){
	var emailRegExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return (emailRegExp.test(emailAddress));
}
//-->