//-- Login
function submit_login_form() {
	document.userlogin.submit();
}


//---- Auto-Tab Cell form entry
function TabNext(obj,event,len,next_field) {
		if (event == "down") {
			phone_field_length = obj.value.length;
		}else if (event == "up") {
			if (obj.value.length != phone_field_length) {
				phone_field_length=obj.value.length;
				if (phone_field_length == len) {
					next_field.focus();
			}
		}
	}
}

function loginuser(redirecturl){
	//alert(redirecturl);
	window.location = redirecturl;	
}


function showcat(section){
	
	if(section == 'TOP10'){
		invi('TOP10',0);
		invi('arcade',1);
		invi('parlour',1);
		invi('sports',1);
		invi('strategy',1);
		document.getElementById("subheadgames").innerHTML = "<b>" + section.toUpperCase() + "</b>";
	}
	else if(section == 'arcade'){
		invi('TOP10',1);
		invi('arcade',0);
		invi('parlour',1);
		invi('sports',1);
		invi('strategy',1);
		document.getElementById("subheadgames").innerHTML = "<b>" + section.toUpperCase() + "</b>";
	}
	else if(section == 'parlour'){
		invi('TOP10',1);
		invi('arcade',1);
		invi('parlour',0);
		invi('sports',1);
		invi('strategy',1);
		document.getElementById("subheadgames").innerHTML = "<b>" + section.toUpperCase() + "</b>";
	}
	else if(section == 'sports'){
		invi('TOP10',1);
		invi('arcade',1);
		invi('parlour',1);
		invi('sports',0);
		invi('strategy',1);
		document.getElementById("subheadgames").innerHTML = "<b>" + section.toUpperCase() + "</b>";
	}
	else if(section == 'strategy'){
		invi('TOP10',1);
		invi('arcade',1);
		invi('parlour',1);
		invi('sports',1);
		invi('strategy',0);
		document.getElementById("subheadgames").innerHTML = "<b>" + section.toUpperCase() + "</b>";
	}	
}

function showcat_new(section){
	
	if(section == 'TOP10'){
		invi('TOP10',0);
		invi('arcade',1);
		invi('Card & Board',1);
		invi('sports',1);
		invi('strategy',1);
		document.getElementById("subheadgames").innerHTML = "<b>" + section.toUpperCase() + "</b>";
	}
	else if(section == 'arcade'){
		invi('TOP10',1);
		invi('arcade',0);
		invi('Card & Board',1);
		invi('sports',1);
		invi('strategy',1);
		document.getElementById("subheadgames").innerHTML = "<b>" + section.toUpperCase() + "</b>";
	}
	else if(section == 'Card & Board'){
		invi('TOP10',1);
		invi('arcade',1);
		invi('Card & Board',0);
		invi('sports',1);
		invi('strategy',1);
		document.getElementById("subheadgames").innerHTML = "<b>" + section.toUpperCase() + "</b>";
	}
	else if(section == 'sports'){
		invi('TOP10',1);
		invi('arcade',1);
		invi('Card & Board',1);
		invi('sports',0);
		invi('strategy',1);
		document.getElementById("subheadgames").innerHTML = "<b>" + section.toUpperCase() + "</b>";
	}
	else if(section == 'strategy'){
		invi('TOP10',1);
		invi('arcade',1);
		invi('Card & Board',1);
		invi('sports',1);
		invi('strategy',0);
		document.getElementById("subheadgames").innerHTML = "<b>" + section.toUpperCase() + "</b>";
	}	
}

function online_showcat(category){
	if(category){
		if (linkfreezeon == 1)
		 window.location= sitepath + "/OnlineGames+category+"+escape(category)+".html";
		else
		 window.location= sitepath + "/OnlineGames.html?category="+escape(category);
	}
	return false;
}

function showcat_new2(catid) {
	for (var i = 0; i < categories_id.length; i++) {
		try {
			invi('divCat_' + categories_id[i].toString(), categories_id[i] == catid ? 0 : 1);
		} catch (ex) {}
		if (categories_id[i] == catid)
		document.getElementById('subheadgames').innerHTML = "<b>" + categories_name[i].toUpperCase() + "</b>";
	}
}

var DHTML = (document.getElementById || document.all || document.layers);
function getObj(name) {
  if (document.getElementById)  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}
	

function openWindow(gameid, size){
	//window.location = sitepath + "/Gator_gameconsole.html?gameid="+gameid+"&size="+size;	
	//window.location = sitepath + "/play-online-games~of~"+gameid+".html?size="+size;	
	if(linkfreezeon ==1) {
	window.location = sitepath + "/play-online-games+of+"+gameid+"+size+"+size+".html";
	}
	else {
	window.location = sitepath + "/play-online-games.html?of="+gameid+"&size="+size;}
}

function goenter(){
	window.location= sitepath + "/GatorArc/sweepsEntry.CFM";
}

//---- Mobile Media Relay
function hidelayer() {
	parent.mypopup.style.display = "none";
	parent.mypopup.innerHTML = "";
	//parent.Container.className = 'FadeOFF';
	//parent.document.getElementById("Container").className = 'FadeOFF';
}

function getmedia(mediaID){
	if(mediaID > 0){
	//PageSubWrapper.style.filter = "alpha(style=0,opacity=50);-moz-opacity:.50;opacity:.50;";
	mypopup.innerHTML = "<iframe src='" + sitepath + "/gatorarc/NM_Media_Relay.HTML?contentType=WP&contentID=" + mediaID + "' frameborder='0' height='345' width='401' scrolling='No''>";
	ReverseContentDisplay('mypopup');
	
	//window.open(sitepath + "/gatorarc/NM_Media_Relay.HTML?contentType=WP&contentID="+mediaID, "Mobile", "width=380,height=250,resizable=1,top=200,left=300,scrollbars=1");
	 return false;
		}
	else
	return false;
}

function getmediatone(mediaID){
	if(mediaID > 0){
	//PageWrapper.style.filter = "alpha(style=0,opacity=50);-moz-opacity:0.50;opacity:0.50;";
	mypopup.innerHTML = "<iframe src='" + sitepath + "/gatorarc/NM_Media_Relay.HTML?contentType=Tone&contentID=" + mediaID + "' frameborder='0' height='345' width='401' scrolling='No''>";
	ReverseContentDisplay('mypopup');
	//PageWrapper.style = filter:alpha(opacity=50);-moz-opacity:.50;opacity:.50;
	//window.open(sitepath + "/gatorarc/NM_Media_Relay.HTML?contentType=WP&contentID="+mediaID, "Mobile", "width=380,height=250,resizable=1,top=200,left=300,scrollbars=1");
	 return false;
		}
	else
	return false;
}

function getpreview(medialink, counter){
	btnsrc = "previewbtn" + counter;
	if(medialink.length > 0){
		if(mypopup.style.display == "none"){
			//alert(medialink);
			document.getElementById(btnsrc).src = myimagepath + "/btn_pause1.gif";
			mypopup.innerHTML = "<iframe src='" + medialink + "' frameborder='0' height='10' width='10''>";	
			mypopup.style.display = "block";
		}
		else {
			//alert('block');
			document.getElementById(btnsrc).src = myimagepath + "/btn_play1.gif";
			mypopup.innerHTML = ""; 
			mypopup.style.display = "none";
		
		}
	 return false;
		}
	else
	return false;
}

function getpreview_M(medialink){
	btnsrc = "previewbtn";	
	if(medialink.length > 0){
		if(document.getElementById("mypopup").style.display == "none"){
			//alert(medialink);
			document.getElementById(btnsrc).src = myimagepath + "/GA_ToneDescPreviewBtn_active.gif";
			document.getElementById("mypopup").innerHTML = "<iframe src='" + medialink + "' frameborder='0' height='1' width='1''>";	
			document.getElementById("mypopup").style.display = "block";
		}
		else {
			//alert('block');
			document.getElementById(btnsrc).src = myimagepath + "/GA_ToneDescPreviewBtn.gif";
			document.getElementById("mypopup").innerHTML = ""; 
			document.getElementById("mypopup").style.display = "none";
		
		}
	 return false;
		}
	else
	return false;
}

function getmediacat(){
	var media = document.myform.wpcat.value;
	
	if(linkfreezeon ==1) {
	window.location= sitepath +"/mobile_ringtones+category+"+media+".html";
	}
	else {
	window.location= sitepath +"/mobile_ringtones.html?category="+media;
	}
	return false;
}

function getmediaauthor(){
	var media = document.myform.wpcat.value;
	var artist = document.myform.WPartist.value;
	
	if(linkfreezeon ==1) {
	window.location=sitepath +"/mobile_ringtones+category+"+media+"+author+"+artist+".html";
	}
	else {
	window.location=sitepath +"/mobile_ringtones.html?category="+media+"&author="+artist;
	}
	return false;
}

function filterRingtones() {
	var media = document.myform.wpcat.value;
	var search = document.myform.Search.value;
	
	if(linkfreezeon ==1) {
		window.location=sitepath + "/mobile_ringtones+category+"+media+"+search+"+search+".html";
	}
	else {
		window.location=sitepath + "/mobile_ringtones.html?category="+media+"&search="+search;
	}
	return false;
}

function skipAhead(e)
{
	// phone number element, and event object parameters
	var numEle;
	var oE;
	var reNum = /\d{3}/gi;
	
	var isIE = (navigator.appName.indexOf("Microsoft") >= 0) ? true:false;
	if(isIE)
	{
		numEle = event.srcElement;
		oE = event;
	}
	else
	{
		numEle = e.target;
		oE = e;
	}
		
	if(numEle.value.length == 3 && reNum.test(numEle.value) && ((parseInt(oE.keyCode) >= 49 && parseInt(oE.keyCode) <= 57) || (parseInt(oE.keyCode) >= 96 && parseInt(oE.keyCode) <= 105)))
	{
		if(numEle.name == "cp1")
			document.cellform.cp2.focus();
		else
			document.cellform.cp3.focus();
	}

}

function goform(){
	if(!document.cellform.chkTerms.checked){
		alert("You must agree to the terms and conditions before submitting.");
		return false;
	}
	else
	document.cellform.submit();
}

function swapmenu(tab){
			if(tab == 'featured'){
				invi('feature',0);
				invi('all',1);
				}
			else if(tab == 'featuredPrem'){
				invi('featurePrem',0);
				invi('allPrem',1);
			}
			else if(tab == 'allPrem'){
				invi('featurePrem',1);
				invi('allPrem',0);
			}
			else if(tab == 'allMobi'){
				invi('featureMobi',1);
				invi('allMobi',0);
			}
			else if(tab == 'featuredMobi'){
				invi('featureMobi',0);
				invi('allMobi',1);
			}
			else{
				invi('feature',1);
				invi('all',0);
				}
		}
		
var DHTML = (document.getElementById || document.all || document.layers);

function getObj(name)
	{
	  if (document.getElementById)
	  {
	  this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	  }
	  else if (document.all)
	  {
		this.obj = document.all[name];
		this.style = document.all[name].style;
	  }
	  else if (document.layers)
	  {
	   	this.obj = document.layers[name];
	   	this.style = document.layers[name];
	  }
	}
	
	
function boxdisapear()
	{
	  if(document.getElementById("MyDivWrapper").style.display == "none")
		{
			document.getElementById("MyDivWrapper").style.display = "block";
		}
		else
		{
			document.getElementById("MyDivWrapper").style.display = "none";
		}
	}

 function openwarning() 
	{
	  var page = sitepath + "/_include/warning.html"
      var winStats="'toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,width=520,height=310,left=10,top=25,screenX=10,screenY=25'";
      
	  window.open(page,"_blank",winStats);
    }	
	
	function killsession() {
		window.location= sitepath + "/Logoff/killsession.html";	 
	}
	
	function LogoffUser() {
		window.location = sitepath + "/Logoff/killsession.html";
	}

	function check(){
		var i;
		for (i=1; i<2; i++){
			// Check for valid e-mail address
			if (eval("document.inviteform.email"+i+".value") != ""){
				var e_add = eval("document.inviteform.email"+i+".value");
				var is_there_at = e_add.indexOf('@');
				if (is_there_at == -1){ 
					msg = "You have entered an invalid email address.";
					alert(msg);	
					return false;
				}
						
				var find_period = e_add.indexOf('.', is_there_at);
				if (find_period == -1){
					msg = "You have entered an invalid email address.";
					alert(msg);
					return false;
				}
						
				var get_separation = is_there_at + 2;
				if (find_period < get_separation){
					msg = "You have entered an invalid email address.";
					alert(msg);
					return false;
				}
						
				if (find_period == e_add.length -1){
					msg = "You have entered an invalid email address.";
					alert(msg);
					return false;
				}
			}
		}
		return true;
	}	
	
// end e-mail ckeck		
function submit_form() {
  if (check()) { document.inviteform.submit(); }
}


function gounsub(user){
	if(confirm("If you cancel your GatorArcade account you will no longer be able to redeem your gas credits. Do you still want to cancel?")){
		window.open(sitepath + "/GatorArc/Gator_Unsub.CFM?MSISDN="+user,"unsub","width=10,height=10,top=1000,left=1000");
		return false;
	}
	else
	return false;
}


function submit_userpass() {
  if (submit_userpass_user()) { document.userpass2.submit(); }
}

function submit_userpass_user() {	
  if ((document.userpass2.cellnum1.value=="") && (document.userpass2.email.value=="")){
	alert("You must enter your cell number or your email address in order to get your password...");
	leaving=1
	return false;			
  }
  return true;
}
	
function EnterContest() 
{	
	document.NumberofEntry.submit();	
}	

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}


function getprize(prize,points){
	var answer = confirm("By continuing, you agree to the terms and "+addCommas(points)+" Prize Points will be deducted from your GatorArcade account. Give me my prize?")
	if (answer){
		//alert("Bye bye!")
		//window.location = "http://www.google.com/";
		
		if(linkfreezeon ==1) {
			window.location=sitepath + "/PrizeRedemption/ProcessRequest+prizeID+" + prize+".cfm";
		}
		else {
			window.location=sitepath + "/PrizeRedemption/ProcessRequest.cfm?prizeID=" + prize;
		}
		
	}
	else{
		//alert("Thanks for sticking around!")
	}	
	
	return false;
}

//My Account Page Script
function goexp(){
	   if(document.getElementById("gamexp").style.display == "none"){
	   	  document.getElementById("gamexp").style.display = "block"
	   }
	   else
	    document.getElementById("gamexp").style.display = "none"
	}
	
	function showsection2(section) {
		var sections = new Array('myaccount', 'myprofile', 'myitems', 'mykeycodes');
		
		for (var i = 0; i < sections.length; i++) {
			invi (sections[i], sections[i] != section);
			document.getElementById('img_' + sections[i]).src = 
				myimagepath + '/'
				+ sections[i] + '_button'
				+ ((sections[i] == section) ? 'over' : '')
				+ '.gif';
		}
	}
	
	function showsubsection_acct(section) {
		var sections = new Array(
			'myacct_changepassword', 'myacct_subinfo', 'myacct_subhandset',
			'myacct_myhighscores', 'myacct_pointhistory', 'myacct_referbyemail', 'myacct_myfriends'
			);
			
		for (var i = 0; i < sections.length; i++) {
			try {
				invi (sections[i], sections[i] != section);
				document.getElementById('a_' + sections[i]).className = (sections[i] == section) ? 'subsection_selected' : 'subsection_notselected';
				document.getElementById('img_' + sections[i]).src = myimagepath + '/GA_MyAccount_' + ((sections[i] == section) ? 'Green' : 'Blue') + 'Arrow.gif';
			} catch (ex) {
				// myacct_referbyemail and myacct_myfriends are not displayed for non-premium users, so they might not
				// exist; ignore exception
			}
		}
	}
	
	function showsubsection_items(section) {
		var sections = new Array(
			'myitems_mydownloadablegames', 'myitems_mymobilemedia');

		for (var i = 0; i < sections.length; i++) {
			invi (sections[i], sections[i] != section);
			document.getElementById('a_' + sections[i]).className = (sections[i] == section) ? 'subsection_selected' : 'subsection_notselected';
			document.getElementById('img_' + sections[i]).src = myimagepath + '/GA_MyAccount_' + ((sections[i] == section) ? 'Green' : 'Blue') + 'Arrow.gif';
		}
	}

	function limitPointHistory(ActionType) {
		document.getElementById('a_PointsHistory_All').style.textDecoration = ActionType == 'All' ? 'underline' : 'none';
		document.getElementById('a_PointsHistory_Debit').style.textDecoration = ActionType == 'Debit' ? 'underline' : 'none';
		document.getElementById('a_PointsHistory_Credit').style.textDecoration = ActionType == 'Credit' ? 'underline' : 'none';
		
		var bFound = true;
		var i = 0;
		var obj;
		while (bFound) {
			bFound = false;
			i++;
			obj = document.getElementById('history_' + i);
			if (obj) {
				if (ActionType == 'All')
					obj.style.display = 'block';
				else 
					obj.style.display = 
						(document.getElementById('_history_' + i).value == ActionType) ? 'block' : 'none';
				bFound = true;
			}
		}		
	}
	
	//----- Secondary Menu Tabs
	function showsection(section){
		if(section == 'mygames'){
			invi('Mygames',0);
			invi('Mytransact',1);
			invi('Myscore',1);
			invi('Overallscore',1);
			invi('Mydetails',1);
			invi('Mypassword',1);
			invi('Myaccount',1);
		}
		else if(section == 'mypoints'){
			invi('Mygames',1);
			invi('Mytransact',1);
			invi('Myscore',1);
			invi('Overallscore',1);
			invi('Mydetails',1);
			invi('Mypassword',1);
			invi('Myaccount',1);
		}
		else if(section == 'mytransact'){
			invi('Mygames',1);
			invi('Mytransact',0);
			invi('Myscore',1);
			invi('Overallscore',1);
			invi('Mydetails',1);
			invi('Mypassword',1);
			invi('Myaccount',1);
		}
		else if(section == 'mydetails'){
			invi('Mygames',1);
			invi('Mytransact',1);
			invi('Myscore',1);
			invi('Overallscore',1);
			invi('Mydetails',0);
			invi('Mypassword',1);
			invi('Myaccount',1);
		}
		else if(section == 'mypass'){
			invi('Mygames',1);
			invi('Mytransact',1);
			invi('Myscore',1);
			invi('Overallscore',1);
			invi('Mydetails',1);
			invi('Mypassword',0);
			invi('Myaccount',1);
		}
		else if(section == 'myaccount'){
			invi('Mygames',1);
			invi('Mytransact',1);
			invi('Myscore',1);
			invi('Overallscore',1);
			invi('Mydetails',1);
			invi('Mypassword',1);
			invi('Myaccount',0);
		}
		else if(section == 'myhighsc'){
			invi('Mygames',1);
			invi('Mytransact',1);
			invi('Myscore',0);
			invi('Overallscore',1);
			invi('Mydetails',1);
			invi('Mypassword',1);
			invi('Myaccount',1);
		}
		else
		{
			invi('Mygames',1);
			invi('Mytransact',1);
			invi('Myscore',1);
			invi('Overallscore',0);
			invi('Mydetails',1);
			invi('Mypassword',1);
			invi('Myaccount',1);
		}
	}
	
	var DHTML = (document.getElementById || document.all || document.layers);
		
	function getObj(name)
		{
		  if (document.getElementById)
		  {
		  this.obj = document.getElementById(name);
			this.style = document.getElementById(name).style;
		  }
		  else if (document.all)
		  {
			this.obj = document.all[name];
			this.style = document.all[name].style;
		  }
		  else if (document.layers)
		  {
		   	this.obj = document.layers[name];
		   	this.style = document.layers[name];
		  }
		}
		
	function invi(selectedlayer,flag)
		{
			if (!DHTML) return;
			var x = new getObj(selectedlayer);
			x.style.display = (flag) ? 'none' : 'block'
		}
	
	function getgame(game){
		window.open("http://img.gatorarcade.com/games/Premium/"+game, "Game", "width=10,height=10,top=1000,left=1000");
		return false;
	}
	
	function getmobigame(gameid){
		if(gameid > 0){
		// window.open(sitepath + "/gatorarc/MobileGame_Relay.HTML?gameid="+gameid, "Mobile", "width=380,height=350,resizable=1,top=200,left=300,scrollbars=1");
		// return false;
		mypopup.innerHTML = "<iframe src='" + sitepath + "/gatorarc/MobileGame_Relay.HTML?gameid=" + gameid + "' frameborder='0' height='345' width='401''>";
		ReverseContentDisplay('mypopup');
		}
		else
		return false;
	}
	
	
	function lookup(){
		var s= new String();
		re = new RegExp ("[^A-Za-z0-9_-]","i");
		var myflag=0;	
		s=document.myform2.username.value;
		result = s.search(re);
		if (result != -1){
			msg = "Your username can only contain alphanumeric and the underscore (_) characters.";
			myflag=1;
			alert(msg);
		}
		
		var myusername = document.myform2.username.value;
		if (myusername.length < 5){
			alert("Usernames must be at least 5 characters long.");
			myflag=1;
		}
	
		if (myflag==0) {
		
			AjaxString = "";
			AjaxString = sitepath + "/_Includes/lookup2.cfm?username=" + document.myform2.username.value;

			//alert(AjaxString);	
			ajaxManager	(AjaxString);
			return false;
			
		}
		else 
		{
			alert("You must enter a username to search for!");
		}
	}
	
	function validate_form() {
		var s= new String();
		re = new RegExp ("[^A-Za-z0-9_-]","i");

		if (document.passform.oldpassword.value == "") {
			alert("You must enter your old password.");
			return false;
		}

		if (document.passform.oldpassword.value == document.passform.password1.value) {
			alert("Old and new password cannot be the same");
			return false;
		}
			
		s=document.passform.password1.value;
		result = s.search(re);
		if (result != -1){
			alert("New password must only be composed of letters, hyphen, numbers or underscores.");
			return false;
		}				

		if (document.passform.password1.value == document.passform.uname.value) {
			alert("Username and new password can't be the same.");
			return false;
		}
	
		if (document.passform.password1.value == "") {
			alert("You must enter your new password.");
			return false;
		}
	
		if (document.passform.password1.value != document.passform.password2.value) {
			alert("Both new passwords don't match.");
			return false;
		}

		var newpassword = document.passform.password1.value;
		if (newpassword.length < 5){
			alert("Please make sure your new password is longer than 5 characters.");
			return false;
		}
	
	return true;
	}
	
	function submitform(){
	  if (validate_form()){
	    document.passform.submit();
	  }
	}
//End My Account Script

//------REDIRECT USER TO CONFIRM THEIR HANDSET BEFORE WE CAN SEND THEM MOBILE CONTENT
//----ADDED BY NORBS
function goto_confirm_hs() {
	alert("To ensure that you are able to receive this content on your mobile phone, please select your mobile device.");
	window.location.replace(sitepath + "/MobileDevice.html");
	return false;
}


//------ Registration Script For Validate
var formsubmited = 0;
	
	function checkForm(){
		var errormessage
		var flagerror
		errormessage = "I am sorry, the following error(s) have occured. \n _________________________________________________________\n"
		flagerror = 0;
		
		var thisphone = document.myform.msisdn1.value  + document.myform.msisdn2.value  + document.myform.msisdn3.value ;
		
		if (document.myform.msisdn1.value == "" ||document.myform.msisdn2.value == "" || document.myform.msisdn3.value == ""){
			errormessage = errormessage + "\n Please enter your cell number.";
			flagerror = 1;		
		}else if (thisphone.length != 10){
			errormessage = errormessage + "\n Please enter your complete cell number.";
			flagerror = 1;		
		}else if (thisphone.substring(0,1) == '1' || thisphone.substring(0,1) == '0' || thisphone.substring(3,4) == '1' || thisphone.substring(3,4) == '0'){
			errormessage = errormessage + "\n Please enter a valid cell number.";
			flagerror = 1;		
		}else if (thisphone == '2222222222' || thisphone == '3333333333' || thisphone == '4444444444' || thisphone == '5555555555' || thisphone == '6666666666' || thisphone == '7777777777' || thisphone == '8888888888' || thisphone == '9999999999'){
			errormessage = errormessage + "\n Please enter a valid cell number.";
			flagerror = 1;		
		} 
		
		if(!document.myform.agree.checked){
			errormessage = errormessage + "\n You must agree to the Terms and Conditions and Privacy Policy to continue.";
			flagerror = 1;		
		}
		if(!document.myform.Confirmbox.checked){
			errormessage = errormessage + "\n You must agree to the Terms and Conditions and Privacy Policy to continue.";
			flagerror = 1;		
		}
		//-- Display error message if Form is incomplete/invalid
		if (flagerror == 1) {
			errormessage = errormessage + "\n_________________________________________________________\n\n Thank You.";
			alert(errormessage);
			return false;
		}else{//-- If no error, submit Form
			if (formsubmited == 0) {
				formsubmited = 1;
				leaving=0;
				return true;
			}else{
				return false;
			}	
		}	
	}
	
	function checkPinForm() {
		var errormessage
		var flagerror
		errormessage = "I am sorry, the following error(s) have occured. \n _________________________________________________________\n"
		flagerror = 0;
		
		
		var confirmbox = document.pinlayer.Confirmbox.checked;
		numbers = new RegExp ("[^0-9]","ig");
		var pinval = document.pinlayer.password.value;
		var cellphone = document.pinlayer.cellphone.value;
		
		re = new RegExp ("[^a-zA-Z0-9]","ig");		
		result = pinval.search(re);		
		cellresult = cellphone.search(re);
		
		if (pinval == "" || pinval.length < 4 || result != -1){
			errormessage = errormessage + "\n Please check your pin and try again.";
			flagerror = 1;		
		}
		
		if (cellphone.length != 10 || cellresult != -1){
			errormessage = errormessage + "\n Please check your cell number and try again.";
			flagerror = 1;	
		}
		/*
		if(!confirmbox){
			errormessage = errormessage + "\n You must agree to the Terms and Conditions and Privacy Policy to continue.";
			flagerror = 1;		
		}*/
		//-- Display error message if Form is incomplete/invalid
		if (flagerror == 1) {
			errormessage = errormessage + "\n_________________________________________________________\n\n Thank You.";
			alert(errormessage);
			return false;
		}else{//-- If no error, submit Form
			if (formsubmited == 0) {
				formsubmited = 1;
				leaving=0;
				return true;
			}else{
				return false;
			}	
		}	
	}
	
function checkPinFormNOTC() {
		var errormessage
		var flagerror
		errormessage = "We\'re sorry, the following error(s) have occured. \n _________________________________________________________\n"
		flagerror = 0;
		
		
		//var confirmbox = document.pinlayer.Confirmbox.checked;
		numbers = new RegExp ("[^0-9]","ig");
		var pinval = document.pinlayer.password.value;
		var cellphone = document.pinlayer.cellphone.value;
		
		re = new RegExp ("[^a-zA-Z0-9]","ig");		
		result = pinval.search(re);		
		cellresult = cellphone.search(re);
		
		if (pinval == "" || pinval.length < 4 || result != -1){
			errormessage = errormessage + "\n Please check your pin and try again.";
			flagerror = 1;		
		}
		
		if (cellphone.length != 10 || cellresult != -1){
			errormessage = errormessage + "\n Please check your cell number and try again.";
			flagerror = 1;	
		}
		
		//-- Display error message if Form is incomplete/invalid
		if (flagerror == 1) {
			errormessage = errormessage + "\n_________________________________________________________\n\n Thank You.";
			alert(errormessage);
			return false;
		}else{//-- If no error, submit Form
			if (formsubmited == 0) {
				formsubmited = 1;
				leaving=0;
				return true;
			}else{
				return false;
			}	
		}	
	}
	
//========================================================
//		Validates content of fields
//========================================================
function checkfield( fieldname, fieldlabel, acceptonly ){	

	var s= new String( );
	characters = new RegExp ("[^A-Za-z .'-]","ig");
	numbers = new RegExp ("[^0-9]","ig");
	numchar = new RegExp ("[^0-9-^A-Za-z .'-]","ig");
	numchar2 = new RegExp ("[^0-9-^A-Za-z.'-]","ig");
	s = document.myform[fieldname].value;
	result = s.search(eval(acceptonly));

	if ( result != -1 ){
		if ((acceptonly == "numchar") || (acceptonly == "numchar2")){
				msg = fieldlabel + " can only contain numbers and characters.";
		}else if( acceptonly == "numbers" ){
			msg = fieldlabel + " can only contain numbers.";
		}else{
			msg = fieldlabel + " can only contain characters.";
		}
	
		document.myform[fieldname].value = s.replace(eval(acceptonly), "");
		alert(msg);
		return false;
	} 
}	


//script for floating layer at cursor position
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
	function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
	function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
	if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
	else { document.onmousemove = UpdateCursorPosition; }
	function AssignPosition(d) {
	if(self.pageYOffset) {
		rX = self.pageXOffset;
		rY = self.pageYOffset;
		}
	else if(document.documentElement && document.documentElement.scrollTop) {
		rX = document.documentElement.scrollLeft;
		rY = document.documentElement.scrollTop;
		}
	else if(document.body) {
		rX = document.body.scrollLeft;
		rY = document.body.scrollTop;
		}
	if(document.all) {
		cX += rX; 
		cY += rY;
		}
	d.style.left = (cX-200) + "px";
	d.style.top = (cY-100) + "px";
	}
	function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
	}
	function ShowContent(d) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	dd.style.display = "block";
	}
	function ReverseContentDisplay(d) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	if(dd.style.display == "none") { dd.style.display = "block"; }
	else { dd.style.display = "none"; }
	}

//end floating layer

//start online-games
	function hiderules() {
		parent.document.getElementById("divinstructions").style.display = "none";
		parent.document.getElementById("divgame").style.display = "block";
	}
	
	function openRules() {
			//var page = sitepath + "/help/sub_section_ins_"+game+".html?framebusted=1"			
			//document.getElementById("divinstructions").innerHTML = "<iframe src='" + page + "' frameborder='1' height='400' width='525' '>";			
			if(document.getElementById("divinstructions").style.display == "block") {
				document.getElementById("divinstructions").style.display = "none";
				document.getElementById("divgame").style.display = "block";
				document.getElementById("intructionimage").src = "_images/console_instructions.gif";
			}
			else {
				document.getElementById("divinstructions").style.display = "block";
				document.getElementById("divgame").style.display = "none";
				document.getElementById("intructionimage").src = "_images/btg.gif";
			}
		}
		
		function openRules2() {
			//var page = sitepath + "/help/sub_section_ins_"+game+".html?framebusted=1"			
			//document.getElementById("divinstructions").innerHTML = "<iframe src='" + page + "' frameborder='1' height='400' width='525' '>";			
			if(document.getElementById("divinstructions").style.display == "block") {
				document.getElementById("divinstructions").style.display = "none";
				document.getElementById("divgame").style.display = "block";
				//document.getElementById("intructionimage").src = "_images/console_instructions.gif";
				document.getElementById("divinstructionslink").style.visibility = "hidden";
			}
			else {
				document.getElementById("divinstructions").style.display = "block";
				document.getElementById("divgame").style.display = "none";
				document.getElementById("intructionimage").src = "_images/btg.gif";
				document.getElementById("divinstructionslink").style.visibility = "visible";
			}
		}
	
		function opennew() {
			window.location=sitepath + "/register2/basic_reg_step1.html?framebusted=1";
		}
		
		var browserversion;
	
		// Captures browser name and writes it to the first element of the first form.
		function getBrowserName(browsername){
			browserversion = navigator.appName;  
	
			if(browsername == 0)
			{
				if (browserversion == "Microsoft Internet Explorer")
				{openwarning();}
				else
				{window.open("http://sdc.shockwave.com/shockwave/download/frameset.fhtml?", "shock", "");}
			}
			else
			{window.open("http://sdc.shockwave.com/shockwave/download/frameset.fhtml?", "shock", "");	}
		}
	
		function openwarning() 
		{
			var page = sitepath + "/include/warning.html";
			var winStats="'toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,width=520,height=310,left=10,top=25,screenX=10,screenY=25'";
	  	window.open(page,"warning",winStats);
		}	
//end online games

//-- Ajax Manager
function ajaxManager(){
	var args = ajaxManager.arguments;

	var x = getTransport();
	
	if (x){
		x.onreadystatechange = function(){
			if (x.readyState == 4 && x.status == 200){
				eval(x.responseText);
//				alert(x.responseText);
			}
		}
		var MyString = args[0];
		x.open("GET", MyString, true);
		x.send(null);
	}else{
		alert('Not Supported');
	}
}	

//-- Ajax Manager
function ajaxManager_return(postpage){
	//-- Return back proper TransportObject --//
	http_request = getTransport();
	 
	//-- If TransportObject is valid //--
	if(http_request) {
		http_request.open('POST', postpage, true);
		http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		http_request.onreadystatechange = function() {
			if (http_request.readyState == 4 && http_request.status == 200) {
				//eval(x.responseText);
				//"<font size='+1' color='57A600'><b>" + http_request.responseText + "</b> points</font>";
				document.getElementById("mypoints").innerHTML = "<font size='+1' color='57A600'><b>" + http_request.responseText + "</b> points</font>";
			}
		} // end capture function
		http_request.send(null);
	}
}           

function SMStrivia(smsaction){
	AjaxString = "";
	AjaxString = sitepath + "/gatorArc/SMS_trivia.cfm?TriviaAction=" + smsaction;
								
	//alert(AjaxString);	
	ajaxManager	(AjaxString);
	return false;
}

function getfrogger(scname){
	window.open(sitepath + "/gatorarc/MobileGame_Relay.HTML?gameid=781&MediaSrc=" + scname, "Frogger", "width=360,height=200,top=150,left=250");
	return false;
}

function take5(medialeft){
	var TempCounter = 0;
	var tonelimit = 20;

	for (var i = 0, n = tonelimit; i < n; i++)	
	{
		if (document.tonefrm.Mobitone[i].checked == true)
		{
			TempCounter = TempCounter + 1;
		}
	}
	
	if(TempCounter != medialeft){
		alert("Please select " + medialeft + " ringtones");
		return false;
	}
	else{
		document.tonefrm.submit();
	}
}

//---- Terminate Gas Accumulation on Unload trigger -----///
function terminategame(gameid, userid){
	AjaxString = "";
	AjaxString = sitepath + "/GamePost/TerminateGame.CFM?gameid=" + gameid + "&userid=" + userid;
								
	//alert(AjaxString);	
	ajaxManager	(AjaxString);
	return false;
}


//----- Redeem Gas Accumulated
function redeemgas(userid){
	if(confirm("You are about to redeem your gas credits, this action cannot be undone once you've redeemed")){
		AjaxString = "";
		AjaxString = sitepath + "/Scripts_GAS/RedeemGas_Ajax.CFM?UserID=" + userid;
								
		//alert(AjaxString);	
		ajaxManager	(AjaxString);
		return false;
	}
	else
	return false;
}

function myitemsgamerelay(gameid,msrc,msisdn,logid){
	AjaxString = "";
	AjaxString = sitepath + "/gatorarc/MobileGame_Relay_Ajax.CFM?gameid=" + gameid + "&MediaSrc=" + msrc + "&msisdn=" + msisdn + "&logid=" + logid;
								
	//alert(AjaxString);	
	ajaxManager	(AjaxString);
	return false;
}

function myitemswprelay(cid,msisdn,lid){
	AjaxString = "";
	AjaxString = sitepath + "/gatorArc/NM_media_relay_ajax.cfm?contentType=WP&sendMedia=1&contentID=" + cid + "&msisdn=" + msisdn + "&logid=" + lid;
								
	//alert(AjaxString);	
	ajaxManager	(AjaxString);
	return false;
}

function myitemsrtrelay(cid,msisdn,lid){
	AjaxString = "";
	AjaxString = sitepath + "/gatorArc/NM_media_relay_ajax.cfm?contentType=Tone&sendMedia=1&contentid=" + cid + "&msisdn=" + msisdn + "&logid=" + lid;
								
	alert(AjaxString);	
	ajaxManager	(AjaxString);
	return false;
}

function myitemsrtrelay_M(cid,msisdn){
	document.getElementById('btnGetIt').disabled = true;
	//document.getElementById('getitnow').innerHTML = "<h3>Processing...</h3>";
	document.getElementById('hs_detect').style.display='block';
	//document.getElementById('sendingdiv').style.display='none';
	
	AjaxString = "";
	AjaxString = sitepath + "/gatorArc/NM_media_relay_ajax.cfm?contentType=Tone&sendMedia=1&contentid=" + cid + "&msisdn=" + msisdn + "&logid=0";
	
								
	//alert(AjaxString);	
	ajaxManager	(AjaxString);
	return false;
}

function myitemswprelay_M(cid,msisdn){
	document.getElementById('btnGetIt').disabled = true;
	document.getElementById('getitnow').innerHTML = "<h3>Processing...</h3>";
	document.getElementById('hs_detect').style.display='block';
	
	AjaxString = "";
	AjaxString = sitepath + "/gatorArc/NM_media_relay_ajax.cfm?contentType=WP&sendMedia=1&contentID=" + cid + "&msisdn=" + msisdn + "&logid=0";
								
	//alert(AjaxString);	
	ajaxManager	(AjaxString);
	return false;
}

function myitemsgamerelay_M(gameid,msrc,msisdn,contentid){
	document.getElementById('btnGetIt').disabled = true;
	document.getElementById('getitnow').innerHTML = "<h3>Processing...</h3>";
	document.getElementById('hs_detect').style.display='block';
	
	AjaxString = "";
	AjaxString = sitepath + "/gatorarc/MobileGame_Relay_Ajax.CFM?gameid=" + gameid + "&MediaSrc=" + msrc + "&msisdn=" + msisdn + "&contentID=" + contentid;
								
	//alert(AjaxString);	
	ajaxManager	(AjaxString);
	return false;
}

function getfrogger(){
		window.open(sitepath + "/gatorarc/MobileGame_Relay.HTML?gameid=781", "Frogger", "width=360,height=250");
		return false;
	}
	
function getsudoku(){
		document.gameform.submit();
	}
	
function skippass(){
	PageWrapper.style.opacity = "1";
	PageWrapper.style.filter = "alpha(opacity=100)";
	passwordchange.style.display = "none";
}

function skippass2(){
	passwordchange2.style.display = "none";
}

function out() {

   	if (document.all) 
    { 
        
		if (event.srcElement.tagName.toLowerCase() == "div") {
			document.getElementById("ratingtop3").style.display='block';
	  		document.getElementById("ratingtop2").style.display='none';	
		}
    } 
    else 
    { 		
		if(document.getElementsByTagName('div')) {
        	document.getElementById("ratingtop3").style.display='block';
	  		document.getElementById("ratingtop2").style.display='none';	
		}
    } 	
	
}

function ratingdesc(numstars) {
	if(numstars == 1){
		document.getElementById("ratingdesc").innerHTML = "= Poor";
	}
	else if(numstars == 2){
		document.getElementById("ratingdesc").innerHTML = "= Alright";
	}
	else if(numstars == 3){
		document.getElementById("ratingdesc").innerHTML = "= Good";
	}
	else if(numstars == 4){
		document.getElementById("ratingdesc").innerHTML = "= Great";
	}
	else if(numstars == 5){
		document.getElementById("ratingdesc").innerHTML = "= Awesome";
	}
}

function rategame(score) {    
	
	//document.getElementById("myrating").innerHTML = "<input type='Hidden' value='" + score + "' name='myrating'>";
	document.getElementById("myrating").value = score;
	
	for (i=1; i<6; i++){
		document.getElementById(i+"star").className = "star" + i;
	}
	
	document.getElementById(score+"star").className = "star" + score + "on";
}

function resetrating(rating) {

	for (i=1; i<6; i++){
		document.getElementById(i+"star").className = "star" + i;
	}
	
	document.getElementById(rating+"star").className = "star" + rating + "on";
	
}

function reviewsubmit() {

	var robchk = document.frmreview.robchk.value;
	var robid = document.frmreview.robid.value;
	var userid = document.frmreview.userid.value;
	var gameid = document.frmreview.gameid.value;
	//var rating = document.frmreview.myrating.value;
	var rating = document.getElementById("myrating").value;
	//var avgrating = document.frmreview.avgrating.value;
	var comment = document.frmreview.comment.value.replace(/^\s+|\s+$/g, '');
		
	if(comment == 0) {
		alert("Please enter a comment to continue!");
	}
	else if (rating == 0 || rating == "undefined") {
		alert("Please select a rating to continue!");
	}	
	else if (robchk == 0) {
		alert("Please enter the verification code to continue!");
	}
	else {
		
		AjaxString = "";
		AjaxString = sitepath + "/gatorArc/reviewsubmit.cfm?Submit=1&robid=" + robid + "&robchk=" + robchk + "&userid=" + userid + "&gameid=" + gameid + "&rating=" + rating + "&comment=" + comment;
									
		//alert(AjaxString);	
		ajaxManager	(AjaxString);
		return false;	
	}
}

function checkforbots() {

	var robchk = document.frmrobotcheck.robchk.value;
	var robid = document.frmrobotcheck.robid.value;
	var trackid = document.frmrobotcheck.trackid.value;
	
	AjaxString = "";
	AjaxString = sitepath + "/gatorArc/botcheck.cfm?Submit=1&robid=" + robid + "&robchk=" + robchk + "&trackid=" + trackid;
								
	//alert(AjaxString);	
	ajaxManager	(AjaxString);
	return false;	
}

function robotpass() {
	//PageWrapper.style.opacity = "1";
	//PageWrapper.style.filter = "alpha(opacity=100)";
	promodiv.style.display = "none";
	promodiv_alert.style.display = "block";
	//SubContainer.style.display = "block";
	
	//window.location=sitepath + "/OnlineGames.html";
} 

function reportproblem() {
	//alert("hi");
	divproblem.style.display = "block";
}

function chkfromproblem() {
	
	var re = /(<([^>]+)>)/gi;		
	var stripcomment = frmproblem.comment.value.replace(re, "");
	
	frmproblem.comment.value = 	stripcomment;
			
	//alert(comment.length);return false;
	if(comment==0) {
		alert("Please enter comment before continuing!");
		return false;
	}
	else {
		
		document.getElementById("btnSubmit").disabled=true;		
		document.frmproblem.submit();
		
	}
}

function changeCarrier(currentCarrier,fromsection) {
	
	if(currentCarrier.toLowerCase()  == document.getElementById('selCarrier').value.toLowerCase()) {
		alert("You have selected the same carrier.\nPlease select a different carrier.");
		return false;
	}
	else {
		window.location = sitepath + "/GatorArc/changeCarrier.cfm?fromsection="+fromsection+"&newCarrier="+document.getElementById('selCarrier').value.toLowerCase();
	}
}	

function prizeredemption(MSISDN,USERID,SRC,ActionType,PointVal){
	//alert("got it");
	AjaxString = "";
	AjaxString = sitepath + "/GatorArc/Gator_PointsAction.CFM?msisdn=" + MSISDN + "&userid=" + USERID + "&src=" + SRC + "&ActionType=" + ActionType + "&PointVal=" + PointVal;
								
	//alert(AjaxString);	
	ajaxManager	(AjaxString);
	return false;
}

/*
function updatescore(userid){
	var AjaxString = "";
	//alert("here");
	AjaxString = sitepath + "/gatorarc/Score_Ajax.cfm?userid="+userid;
								
	//alert(AjaxString);	
	ajaxManager_return	(AjaxString);
	return false;
}
*/

function copyToClipboard(s)
{
	if (window.clipboardData && clipboardData.setData)
		clipboardData.setData("Text", s);
}

var leaving = 1;

function gotoGF(){
	if(leaving > 0){
		window.location = sitepath + '/OnlineGames.HTML';
	}
}

function SelectGameCat () {		// used by downloadgames.html
	var foo = document.getElementById('ddlCat');
	var strCat = foo.options[foo.selectedIndex].value;
	if (linkfreezeon == 1)
		window.location = sitepath + '/DownloadGames+category+' + strCat + '.HTML';
	else
		window.location = sitepath + '/DownloadGames.html?category=' + strCat;

}

function raf_validateEmails () {
	
	var friendemail_1 = document.getElementById("FriendEmail1").value.replace(/^\s+|\s+$/g, '');
	var friendemail_2 = document.getElementById("FriendEmail2").value.replace(/^\s+|\s+$/g, '');
	var friendemail_3 = document.getElementById("FriendEmail3").value.replace(/^\s+|\s+$/g, '');
	var friendemail_4 = document.getElementById("FriendEmail4").value.replace(/^\s+|\s+$/g, '');
	var friendemail_5 = document.getElementById("FriendEmail5").value.replace(/^\s+|\s+$/g, '');
	var friendemail_6 = document.getElementById("FriendEmail6").value.replace(/^\s+|\s+$/g, '');
	//var friendemail_7 = document.getElementById("FriendEmail7").value.replace(/^\s+|\s+$/g, '');
	//var friendemail_8 = document.getElementById("FriendEmail8").value.replace(/^\s+|\s+$/g, '');
	//var friendemail_9 = document.getElementById("FriendEmail9").value.replace(/^\s+|\s+$/g, '');
	//var friendemail_10 = document.getElementById("FriendEmail10").value.replace(/^\s+|\s+$/g, '');
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	
	var SenderName1 = document.getElementById("SenderName").value.replace(/^\s+|\s+$/g, '');
	var err = "";
	
	if (SenderName1.length == 0) {
		err += "Please enter your Name.\n";
	}
	if (friendemail_1.length != 0 && !reg.test(friendemail_1)) {
		err += "Please verify your first friend's email address.\n";
	}
	if (friendemail_2.length != 0 && !reg.test(friendemail_2)) {
		err += "Please verify your second friend's email address.\n";
	}
	if (friendemail_3.length != 0 && !reg.test(friendemail_3)) {
		err += "Please verify your third friend's email address.\n";
	}
	if (friendemail_4.length != 0 && !reg.test(friendemail_4)) {
		err += "Please verify your fourth friend's email address.\n";
	}
	if (friendemail_5.length != 0 && !reg.test(friendemail_5)) {
		err += "Please verify your fifth friend's email address.\n";
	}
	if (friendemail_6.length != 0 && !reg.test(friendemail_6)) {
		err += "Please verify your sixth friend's email address.\n";
	}
	if (err.length > 0)	{
		alert (err);
		return false;
	}
	else {
		return true;
	}
}


// <!-- storefront -->
function showSweepstakes() {
	if (intUserPoints < POINTS_PER_TICKET)
		document.getElementById('divSweepsInsufficient').style.visibility = 'visible';
	else
		document.getElementById('divSweepsOuter').style.visibility = 'visible';

	document.getElementById('divPageFade').style.visibility = 'visible';
}

function hideSweepstakes() {
	document.getElementById('divSweepsOuter').style.visibility = 'hidden';
	document.getElementById('divPageFade').style.visibility = 'hidden';
}

function hideSweepsInsufficient() {
	document.getElementById('divSweepsInsufficient').style.visibility = 'hidden';
	document.getElementById('divPageFade').style.visibility = 'hidden';
}

function incTickets() {
	intTickets++;
	updateTickets();
}

function decTickets() {
	intTickets--;
	updateTickets();
}

function updateTickets() {
	if (intTickets < 0)
		intTickets = 0;
	else if (intUserPoints < (intTickets * POINTS_PER_TICKET))
		intTickets = Math.floor(intUserPoints / POINTS_PER_TICKET);
		
	document.getElementById('spnTickets').innerHTML = intTickets.toString();
	document.getElementById('spnPoints').innerHTML = numFormat(intTickets * POINTS_PER_TICKET);
}

function submitTickets(PrizeID) {
	hideSweepstakes();

	if (intTickets > 0) {
		if (linkfreezeon == 1)
			document.location = ('Prizes+trade.html?prizeid=' + PrizeID + '&tickets=' + intTickets.toString());
		else
			document.location = ('Prizes.html?trade&prizeid=' + PrizeID + '&tickets=' + intTickets.toString());
	}
}

function numFormat(number) {
	var ret = '';
	var str = number.toString();
	for (var i = 0; i < str.length; i++) {
		if (i > 0 && (str.length - i) % 3 == 0)
			ret += ',';
		ret += str.charAt(i);
	}
	return ret;
}

function getTransport() {
	return these(
		function() { return new XMLHttpRequest(); },
		function() { return new ActiveXObject('Msxml2.XMLHTTP'); },
		function() { return new ActiveXObject('Microsoft.XMLHTTP'); }
	) || false;
}

function these()
{
	var r; 
	
	for(var i = 0; i < arguments.length; i++) {
		try {
			var delFunction = arguments[i];
			r = delFunction();
			break;
		} catch (e) { }
	} return r;
}


// <!-- end storefront -->

