//<Script>

// Adds Local Name prefix to page title
function UseLocalTitle()
{
    var localName = ReplaceAll(getCookieVal("CorpName"), "&#160;", " ");
	if(localName && localName != "")
		document.title = localName + " - " + document.title;
}

function openExtBrowserWindow(sUrl)
{	
	//alert("opening " + sUrl);
	
	var extWindow = window.open(sUrl, 'ComcastExternal');
	extWindow.focus();
}

function openExtTextWindow(openURL,WindowName,width,height,scroll) 
{
    var winl = (screen.width-width)/2;
    var wint = (screen.height-height)/2;
    var settings  ='height='+height+',';
      settings +='width='+width+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=yes,toolbar=no,location=no,status=no,menubar=no,resizable=yes';
    var newwindow = window.open(openURL,WindowName,settings);
    newwindow.focus();
    return newwindow;
}


// Popup for email preferences
function OpenEmailPopup(PopupEmail,PopupAccount) {

	var sUrl = "";
	var newwindow = openExtTextWindow('','EmailPopup',500, 655, 'yes');
	
	var oPopForm = GetEmailPopupForm();
	oPopForm.e.value = PopupEmail;
	oPopForm.AcctNum.value = PopupAccount;
	oPopForm.submit();
	   
    newwindow.focus();
}

function GetEmailPopupForm()
{
	var oForm;
	if(document.getElementById)
		oForm = document.getElementById("PopupForm");
	else if (document.all)
		oForm = document.all["PopupForm"];
	else
		oForm = document.forms["PopupForm"];
		
	return oForm;
}


	

// Set width of text box depending on NN/IE to maintain layout.
function setBoxsize(oName) {
	if (document.layers) 
		oName.size = 20;
	else {
		oName.size = 30; 
	}
}

function ViewDemo()
{	
	window.open("/UserIncludes/Demo.html",'Demo','toolbar=no,location=no,status=no,menubar=no,resizable=no,width=660,height=420,scrollbars=no')
}

function swap(oImage,sNew)
{
	oImage.src = "/images/buttons/" + sNew;
}

function GetCookie(key1,key2)
{	

	var sCookie = new String(document.cookie);
	//alert(sCookie)
	if(key1 != null)
	{
		var aCList = sCookie.split('; ');
		for(var i = 0;i < aCList.length;i++)
		{
			sCookie = aCList[i];
			var oReg = new RegExp("(^"+key1+"=)(.*)","ig");
			var aResult = oReg.exec(sCookie);
			if(aResult != null)
			{
				sCookie = RegExp.$2;
				if(key2 != null)
				{
					aCList = sCookie.split("&");
					for(var i = 0;i < aCList.length;i++)
					{
						sCookie = aCList[i];
						var oReg = new RegExp("(^"+key2+"=)(.*)","ig");
						var aResult = oReg.exec(sCookie);;
						if(aResult != null)
						{
							sCookie = unescape(RegExp.$2);
							break;
						}else {
							sCookie = false;
						}
					}
				}
				break;
			} else {
				sCookie = false;
			}
		}
	}
	return sCookie;
}

function GetMenuCookie(key1,key2)
{	

	var sCookie = new String(document.cookie);
	//alert(sCookie)
	if(key1 != null)
	{
		var aCList = sCookie.split('; ');
		for(var i = 0;i < aCList.length;i++)
		{
			sCookie = aCList[i];
			var oReg = new RegExp("(^"+key1+"=)(.*)","ig");
			var aResult = oReg.exec(sCookie);
			if(aResult != null)
			{
				sCookie = RegExp.$2;
				if(key2 != null)
				{
					aCList = sCookie.split("&");
					for(var i = 0;i < aCList.length;i++)
					{
						sCookie = aCList[i];
						var oReg = new RegExp("(^"+key2+"=)(.*)","ig");
						var aResult = oReg.exec(sCookie);
						if(aResult != null)
						{
							sCookie = unescape(RegExp.$2);
							break;
						}else {
							sCookie = -1;
						}
					}
				}
				break;
			} else {
				sCookie = -1;
			}
		}
	}
	return sCookie;
}


/* Switch button from "Products In My Area" to "Order Now" if they're localized.
	Pass in product type to select its box on next page (Serviceability)
*/	
function SwitchButtons (Product) {	
	//alert("called the switcher");

	var sAddress = GetCookie("Serviceability","Address");
	var sInternet = GetCookie("Serviceability","NumInternetProductsAvailable");
	var sDigital = GetCookie("Serviceability","NumDigitalProductsAvailable");
	
	/* debug strings
	alert("Address is: " + sAddress + "\n" +
		"Int Products:  " + sInternet+ "\n" +
		"Dig Products:  " + sDigital);
	*/
	
	if (!sAddress) {		// Not localized
		document.write('<a href="/Products/Serviceability.asp?SourcePage=' + Product + ' " onmouseover="swap(document.Continue,\'productsinmyarea_over.gif\')" onmouseout="swap(document.Continue,\'productsinmyarea.gif\')"><img align="right" src="/images/buttons/productsinmyarea.gif" border="0" name="Continue" /></a>');
	}
		
	if (sAddress) {			// Localized
		
		// Hold this fork until Phase 2	
		// if ( (sDigital > 0) || (sInternet > 0) )		// Product available
			document.write('<a href="/Products/Serviceability.asp?SourcePage=' + Product + ' " onmouseover="swap(document.Continue,\'OrderNow_over.gif\')" onmouseout="swap(document.Continue,\'OrderNow.gif\')"><img align="right" src="/images/buttons/OrderNow.gif" border="0" name="Continue" /></a>');

		/* Hold until Phase 2
		else {											// Product NOT available
			//alert("No products");
			document.write('<a href="../ContactUs/NotifyMe.ashx" onmouseover="swap(document.Continue,\'NotifyMe_over.gif\')" onmouseout="swap(document.Continue,\'NotifyMe.gif\')"><img align="right" src="/images/buttons/NotifyMe.gif" border="0" name="Continue" /></a>');
			// TODO Need to fix the link for aspgen???
		}
		*/
	}
}


/*  The cookies N
	Switch button from "Products In My Area" to "Check Availability" if they're localized.
	Pass in product type to select its box on next page (Serviceability)
*/	
function SwitchToContinue(Product, sButton1, sButton2) {	
	//alert("called the switcher" + Product);

	var sAddress = GetCookie("Serviceability","Address");
	
	// Use default button images if non are provided
	if((!sButton1 && !sButton2) || (sButton1.length == 0 && sButton2.length == 0))
	{
		if(sAddress)
		{
			sButton1 = "Continue.gif";
			sButton2 = "Continue_over.gif";
		}
		else
		{
			sButton1 = "CheckAvailability.gif";
			sButton2 = "CheckAvailability_over.gif";
		}
	}
	
	/* debug strings
	alert("Address is: " + sAddress + "\n" +
		"Int Products:  " + sInternet+ "\n" +
		"Dig Products:  " + sDigital);
	*/
	
	
	document.write('<a href="/Buyflow/default.ashx?SourcePage=' + Product + ' " onmouseover="swap(document.Continue,\'' + sButton2 + '\')" onmouseout="swap(document.Continue,\'' + sButton1 + '\')"><img align="right" src="/images/buttons/' + sButton1 + '" border="0" name="Continue" /></a>');
}


/* 
	Trim a string to fit. Shortens and adds ellipsis (...).
	Pass in string and max length.
	Used to trim long corp name display in header bar (menu.xslt).	
	Remove broken character entity at end of line to prevent rendering '&#16' for '&#160;', etc.
*/
function TrimString(LongString,MaxLength)
{
	
	//Check for end-of-line partial character entity after trimming a string to prevent rendering something like '&#16' for '&#160;'
	var oRegYes = new RegExp("(&.{0,5}\.\.\.)$" );

	var NewString = LongString;
		
	if (LongString.length > MaxLength)
	{
		NewString = LongString.substr(0,MaxLength) + "... ";
		
		if( NewString.match(oRegYes) )
		{
			//alert(NewString.search(oRegYes));			
			NewString = NewString.replace(oRegYes,"... ");
			//alert("after: " + NewString);
		}
	}
	return NewString;
}



/***************************************************************************
	Autotab the 3-box phone fields
	NOTE: Don't call from 3rd box if the next field cannot receive focus.
****************************************************************************/

var isNN = (navigator.appName.indexOf("Netscape") != -1 ); 
 
function autoTab(input,len, e) { 
	var keyCode	= (isNN) ? e.which : e.keyCode; 
	var filter	= (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46]; 
	if( input.value.length >= len && !containsElement(filter, keyCode)) { 
		input.value = input.value.slice( 0, len ); 
		input.form[(getIndex(input) + 1) % input.form.length].focus(); 
	} 
	return true; 
} 
 
function containsElement(arr, ele) { 
	var found = false, index = 0; 
	while(!found && index < arr.length) 
	if(arr[index] == ele) { 
		found = true; 
	} else { 
		index++; 
	} 
	return found; 
} 
 
function getIndex(input) { 
	var index = -1, i = 0, found = false; 
	while (i < input.form.length && index == -1) 
	if (input.form[i] == input) { 
		index = i; 
	} else { 
		i++; 
	} 
	return index; 
}


//Get Telephony Serviceability from cookies. Used by search.
function GetTelephonyServ()
{
	var iTelType = -1;
	var ServType = GetCookie('Serviceability','LocalizationTypeID')
	if(ServType == 1 || ServType == 2  || ServType == 9 )
	{
		var bVOIP = GetCookie("Menu","VO") == 1;
		var bDTS = GetCookie("Menu","DP") == 1;
		if(bDTS && bVOIP)
		{
			iTelType = -2;
		}
		else if(bVOIP)
		{
			iTelType = 5;
		}
		else if(bDTS)
		{
			iTelType = 4;
		}	
	}

	return iTelType;
}


/*******************************************************************
	In The Community Scholarships functions
	Set states and years for select boxes.
*******************************************************************/

function setState()
{
	var theYear = document.theForm.year.options[document.theForm.year.selectedIndex].value;
	
	if (theYear == "05"){
  		// clear the array so values don't get added to an existing select list
  		document.theForm.state.options.length = 0;
  		// create an array of 2004 states and add them to array with the Option constuctor
  		arr2005 = new Array("Alabama", "Arizona", "Arkansas", "California", "Colorado", 
  						    "Connecticut", "Delaware", "Florida", "Georgia", "Illinois",
  						     "Indiana", "Kansas", "Kentucky", "Massachusetts", "Maine",
  						    "Maryland", "Michigan", "Minnesota", "Missouri", "Mississippi",
  						    "New Jersey", "New Hampshire", "New Mexico", "Ohio", "Oregon", "Pennsylvania", 
  						    "South Carolina", "Tennessee", "Texas", "Utah", "Virginia", "Washington", "Washington, D.C.",
  						    "Wisconsin", "West Virginia");
  		for(var i=0; i<arr2005.length; i++)	
		document.theForm.state.options[document.theForm.state.options.length] = new Option(arr2005[i]);
  		// set the first option to be selected to avoid a blank in the drop down box
  		
  		document.theForm.state.options[0].selected = true;
  		
	}
	
	if (theYear == "04"){
  		// clear the array so values don't get added to an existing select list
  		document.theForm.state.options.length = 0;
  		// create an array of 2004 states and add them to array with the Option constuctor
  		arr2004 = new Array("Alabama", "Arizona", "Arkansas", "California", "Colorado", 
  						    "Connecticut", "Delaware", "Florida", "Georgia", "Illinois",
  						     "Indiana", "Kansas", "Massachusetts", "Maine",
  						    "Maryland", "Michigan", "Minnesota", "Missouri", "Mississippi",
  						    "New Jersey", "New Hampshire", "New Mexico", "Ohio", "Oregon", "Pennsylvania", 
  						    "Tennessee", "Texas", "Utah", "Virginia", "Washington", "Washington, D.C.",
  						    "Wisconsin", "West Virginia");
  		for(var i=0; i<arr2004.length; i++)	
		document.theForm.state.options[document.theForm.state.options.length] = new Option(arr2004[i]);
  		// set the first option to be selected to avoid a blank in the drop down box
  		
  		document.theForm.state.options[0].selected = true;
  		
	}
	
	if (theYear == "03"){
  		// clear the array so values don't get added to an existing select list
  		document.theForm.state.options.length = 0;
  		// create an array of 2003 states and add them to array with the Option constuctor
  		arr2003 = new Array("Arizona", "Arkansas", "Connecticut", "Delaware", "Indiana", "Maryland", "Michigan", 
  			"Missouri", "New Jersey", "New Mexico", "Pennsylvania", "Virginia", "Washington, D.C.");
  		for(var i=0; i<arr2003.length; i++)	
		document.theForm.state.options[document.theForm.state.options.length] = new Option(arr2003[i]);
  		// set the first option to be selected to avoid a blank in the drop down box
  		
  		document.theForm.state.options[0].selected = true;
  		
	}
	
	if (theYear == "02"){
  		// clear the array so values don't get added to an existing select list
  		document.theForm.state.options.length = 0;
  		// create an array of 2002 states and add them to array with the Option constuctor
  		arr2002 = new Array("Arizona", "Arkansas",  "Connecticut", "Delaware", "Indiana", "Michigan", "New Jersey", 
		"New Mexico", "Pennsylvania");
  		for(var i=0; i<arr2002.length; i++)	
		document.theForm.state.options[document.theForm.state.options.length] = new Option(arr2002[i]);
  		// set the first option to be selected to avoid a blank in the drop down box
  		document.theForm.state.options[0].selected = true;
	}
	if (theYear == "01"){
		// clear the array so values don't get added to an existing select list
  		document.theForm.state.options.length = 0;
		// create an array of 2001 states and add them to array with the Option constuctor
  		arr2001 = new Array("Delaware", "New Jersey", "Pennsylvania");
  		for(var i=0; i<arr2001.length; i++)
		document.theForm.state.options[document.theForm.state.options.length] = new Option(arr2001[i]);
		// set the first option to be selected to avoid a blank in the drop down box
  		document.theForm.state.options[0].selected = true;
	}
}

/* Display correct year in select box.
	Put year in page variable and call from onload
*/
function SelectYear(year)
{	
	var yr = 0;
	if (year == "2005")
		yr = 0;
	if (year == "2004")
		yr = 1;
	if (year == "2003")
		yr = 2;
	if (year == "2002")
		yr = 3;
	if (year == "2001")
		yr = 4;
		
	document.theForm.year.options[yr].selected = true;	
}

/* Display correct state in select box.
	Put statename in page variable and call from onload
*/
function SelectState(statename)
{
	var abrev = "";
	//alert(statename);
	switch(statename) 
	{
		case "AL":
			abrev="Alabama";
			break;
		case "AZ": 
			abrev="Arizona";
			break;
		case "AR": 
			abrev="Arkansas";
			break;
		case "CA": 
			abrev="California";
			break;
		case "CO": 
			abrev="Colorado";
			break;
		case "CT": 
			abrev="Connecticut";
			break;
		case "DE": 
			abrev="Delaware";
			break;
		case "FL": 
			abrev="Florida";
			break;
		case "GA": 
			abrev="Georgia";
			break;
		case "IN": 
			abrev="Indiana";
			break;
		case 'IL': 
			abrev="Illinois";
			break;
		case 'KS':
			abrev="Kansas";
			break;
		case 'KY':
			abrev="Kentucky";
			break;
		case 'MA':
			abrev="Massachusetts";
			break;
		case 'ME':
			abrev="Maine";
			break;
		case "MD": 
			abrev="Maryland";
			break;
		case "MI": 
			abrev="Michigan";
			break;
		case "MN":
			abrev="Minnesota";
			break;
		case "MO": 
			abrev="Missouri";
			break;
		case "MS": 
			abrev="Mississippi";
			break;
		case "NH": 
			abrev="New Hampshire";
			break;
		case "NJ": 
			abrev="New Jersey";
			break;
		case "NM": 
			abrev="New Mexico";
			break;
		case "OH": 
			abrev="Ohio";
			break;
		case "OR": 
			abrev="Oregon";
			break;
		case "PA": 
			abrev="Pennsylvania";
			break;
		case "SC":
			abrev="South Carolina";
			break;
		case "TN": 
			abrev="Tennessee";
			break;
		case "TX": 
			abrev="Texas";
			break;
		case "UT": 
			abrev="Utah";
			break;
		case "VA": 
			abrev="Virginia";
			break;
		case "WA": 
			abrev="Washington";
			break;
		case "WDC": 
			abrev="Washington, D.C.";
			break;
		case "WI": 
			abrev="Wisconsin";
			break;
		case "WV": 
			abrev="West Virginia";
			break;
	}
	//alert(abrev);
	for(var i = 0;i < document.theForm.state.options.length; i++)
	{
		if(document.theForm.state.options[i].text == abrev)
		{
			document.theForm.state.options[i].selected = true;	
			break;
		}
	}
		
	
}

/********************************************
End of ITC functions
*********************************************/

function togglePasswordField(focused,passwordFld) {
	passwordObject = passwordFld;
	passwordPlaceholder = document.getElementById("PasswordPlaceholder");
	showPassword = (focused || passwordObject.value!="");
	passwordPlaceholder.style.display = (showPassword) ? "none" : "block";
	passwordObject.style.display = (showPassword) ? "block" : "none";
	if (showPassword && focused) passwordObject.focus();
}

function toggleTextField(textFieldObject, focused, defaultValue) {
	if (textFieldObject.value == defaultValue && focused) textFieldObject.value = "";
	if (textFieldObject.value == "" && !focused) textFieldObject.value = defaultValue;
}

/********************************************
Query String parsing
*********************************************/
function PageQuery(q) {
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
			if(this.keyValuePairs[j].split("=")[0] == s)
			return this.keyValuePairs[j].split("=")[1];
		}
		return false;
	}
	this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; }
}
//This function will return the value of the named pair specified by "key"
function queryString(key){
	var page = new PageQuery(window.location.search);
	return unescape(page.getValue(key));
}

function displayItem(key){
	if(queryString(key)=='false')
	{
		document.write("you didn't enter a ?name=value querystring item.");
	}else{
		document.write(queryString(key));
	}
}

function addClassToNode(node, className)
{
	node.className += " " + className;
	
}

function removeClassFromNode(node, className)
{
	// Try removing w/ the space first then w/o the leading space.
	// The first class on a node won't have the leading space.
	node.className = node.className.replace(new RegExp(" " + className + "\\b"), "");
	node.className = node.className.replace(new RegExp(className + "\\b"), "");
}

function clearValue(input, defaultValue)
{
	if(defaultValue == "Password" && input.type == "text")
	{	
		try
		{
			var type = input.getAttributeNode("type");
			type.nodeValue = "password";
		}
		catch (e)
		{
			var newInput = document.createElement("input");
			newInput.type = "password";
			input.replaceNode(newInput);
			newInput.id = "password"
			newInput.name = "password";
			newInput.className = "text";
			newInput.onblur = function() { testValue(newInput, "Password"); }
			newInput.focus();
			newInput.focus(); // needs double focus for some reason
			input = newInput;
		}
		input.focus();
	}
	if(input.value == defaultValue)
		input.value = "";
}

function testValue(input, defaultValue)
{
	if(defaultValue == "Password" && input.value == "")
	{
		try
		{
			input.type = "text";
		}
		catch (e)
		{
			var newInput = document.createElement("input");
			newInput.type = "text";
			input.replaceNode(newInput);
			newInput.id = "password"
			newInput.name = "password";
			newInput.className = "text";
			newInput.onfocus = function() { clearValue(newInput, "Password"); }
			newInput.value = defaultValue;
			input = null;
			return;
		}
	}
	if(input.value == "")
		input.value = defaultValue;
}

// Functions for CM Forms

function FormRequired(field)
{
	if (field.type=="checkbox" || field.type=="radio") {
		if (!field.checked){
			return field.name + " is a required field.\n";
		}
	} else if (field[0] && (field[0].type=="checkbox" || field[0].type=="radio")) {
		var check = false;
		var name = field[0].name;
		for (var i=0; i<field.length; i++) {
			if (field[i].checked) {
				check = true;
			}
		}
		if (!check) {
			var msg;
			if (field.type=="checkbox"){
				msg = "Please choose at least one option from ";
			}
			else {
				msg = "Please choose an option from ";
			}
			return msg + name + "\n";
		}
	} else if (field.type=="select-one" || field.type=="select-multiple") {
		if (field.options[field.selectedIndex].value=="")
			return field.name + " is a required field.\n";
	} else {
		if (field.length == 0 || field.value == "") {
			return field.name+" is a required field.\n";
		}
	}
	return "";
}

// NOTE: Remove the else branch after localization is implemented. It simply prevents showing a broken page.
function validateZIP(zfield) 
{
		var zvalue = zfield.value;
		var zerocount = 0;
		if (zvalue.length!=5) {
			alert("Please enter a 5-digit ZIP Code.");
			zfield.focus();
			return false;
		}
		for (var i=0; i < zvalue.length; i++) {
			temp = "" + zvalue.substring(i, i+1);
			if (temp == "0") zerocount++;
			if (zerocount == 5) {
				alert("Please enter a valid 5-digit ZIP Code.");
				zfield.select();
				return false;
			}
		}
		var valid = "0123456789"
		var ok = "yes";
		var temp;
		for (var i=0; i < zvalue.length; i++) {
			temp = "" + zvalue.substring(i, i+1);
			if (valid.indexOf(temp) == "-1") ok = "no";
		}
		if (ok == "no") {
			alert("Please enter a valid 5-digit ZIP Code.");
			zfield.focus();
			return false;
		}
	
		return true;
}

function ValidateEmail(efield, required)
{
	if (required == false && efield.value == "") {
		return "";
	}
	
	var evalue = efield.value;

	var error = "Invalid E-mail Address.\n";
	var at = "@";
	var dot = ".";
	var lat = evalue.indexOf(at);
	var lstr = evalue.length;
	var ldot = evalue.indexOf(dot);

	if (lat == -1 || lat == 0 || lat == lstr){
		return error;
	}

	if (ldot == -1 || ldot == 0 || ldot == lstr){
		return error;
	}

	if (evalue.indexOf(at, (lat + 1)) != -1){
		return error;
	}

	if (evalue.substring(lat - 1, lat) == dot || evalue.substring(lat + 1, lat + 2) == dot || evalue.substring(lstr - 1, lstr) == dot || evalue.substring(lstr - 2, lstr - 1) == dot){
		return error;
	}

	if (evalue.indexOf(dot, (lat + 2)) == -1){
		return error;
	}

	if (evalue.indexOf(" ") != -1){
		return error;
	}
	
	return "";
}

function ValidatePhone(pfield, required)
{
	if (required == false && pfield.value == "") {
		return "";
	}
	
	var pvalue = pfield.value;
	rePhoneNumber = new RegExp(/^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/);

	if (!pvalue.match(rePhoneNumber)) {
		return "Please enter Phone Number in the format: (555) 555-1234\n";
	}
	
	return "";
}

function ValidateZIPCode(zfield, required)
{
	if (required == false && zfield.value == "") {
		return "";
	}
	
	var zvalue = zfield.value;
	var zerocount = 0;
	if (zvalue.length!=5) {
		return "Please enter a 5-digit ZIP Code.\n";
	}
	for (var i=0; i < zvalue.length; i++) {
		temp = "" + zvalue.substring(i, i+1);
		if (temp == "0") zerocount++;
		if (zerocount == 5) {
			return "Please enter a valid 5-digit ZIP Code.\n";
		}
	}
	var valid = "0123456789"
	var ok = "yes";
	var temp;
	for (var i=0; i < zvalue.length; i++) {
		temp = "" + zvalue.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") {
		return "Please enter a valid 5-digit ZIP Code.\n";
	}

	return "";
}

function ForceSSL()
{
	if(window.location.protocol == "http:")
		window.location = "https://" + window.location.hostname + window.location.pathname + window.location.search;
}

function ReplaceAll(value, find, replace)
{
	while(value.indexOf(find) != -1) {
		value = value.replace(find, replace);
	}
	
	return value;
}