//Functions for the pages

function Log_Off()
	{
	AJAXData('LOGOFF','NOW');
	window.location.reload( true );
	}

//Move to top
function toTop(layer, action, z) // layer== id of div, action:true==show,false==hide, z==z index
	{
	var lref;
	
	if(document.getElementById && (lRef=document.getElementById(layer)))
		{
		lRef.style.visibility=action?'visible':'hidden';
		lRef.style.zIndex=z;
		}
	}

//Left of String
function sLeft(str, n)
	{
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
	}

//Right of String	
function sRight(str, n)
	{
    if (n <= 0)
		return "";
    else if (n > String(str).length)
		return str;
    else 
		{
		var iLen = String(str).length;
		return String(str).substring(iLen, iLen - n);
		}
	}
function AJAXGetProfile2(sVal) 
	{ 
	DIVHide('DIVPROFILE');
	var sTemp='Retrieving information from Server...<br><br><br><br><br><br><br><br>Please Wait...<br><br><br><br><br><br><br><br>'
	printResult(sTemp);
	REPO('DIVPROFILE');
	AJAXData2('PRO',sVal);
	//setTimeout("DIVHide('DIVPROFILE');",20000);
	}

function AJAXGetProfile(sVal) 
	{ 
	DIVHide('DIVPROFILE');
	var sTemp='Retrieving information from Server...<br><br><br><br><br><br><br><br>Please Wait...<br><br><br><br><br><br><br><br>'
	printResult(sTemp);
	REPO('DIVPROFILE');
	AJAXData('PRO',sVal);
	//setTimeout("DIVHide('DIVPROFILE');",20000);
	}

function Apause(millis) 
	{
	var date = new Date();
	var curDate = null;

	do { curDate = new Date(); } 
	while(curDate-date < millis);
	} 


function goLite(BTN)
	{
	document.getElementById(BTN).style.filter = "progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#ff77AAFF',EndColorStr='#ffDDDDDD')";
	}

function goDim(BTN)
	{
	document.getElementById(BTN).style.filter = "";
	}

	
 function REPO(DIVID)
 	{
 	var DIVMain = document.getElementById(DIVID);
 	var IpopTop = ((document.body.clientHeight - DIVMain.offsetHeight) / 2);
    var IpopLeft = ((document.body.clientWidth - DIVMain.offsetWidth) / 2);
            
    DIVMain.style.left=(IpopLeft + document.body.scrollLeft)+'px';
    DIVMain.style.top=(IpopTop + document.body.scrollTop)+'px';
    
    DIVMain.style.display="block";
    
  	toTop(DIVID, true, 100); 
    
    DIVMain.style.visibility="visible";
    }
       	
function DIVHide(DIVID)
 	{
 	var DIVMain = document.getElementById(DIVID);
	
	toTop(DIVID, false, 0); 
	
    DIVMain.style.visibility="hidden";
    }



function makeHttpRequest(url, callback_function, return_xml) 
	{ 
	var http_request = false; 

	if (window.XMLHttpRequest) 
		{ // Mozilla, Safari,... 
	    http_request = new XMLHttpRequest(); 
	    if (http_request.overrideMimeType) 
			{ 
	        http_request.overrideMimeType('text/xml'); 
			} 
		} 
	else if (window.ActiveXObject) 
		{ // IE 
	    try 
			{ 
	        http_request = new ActiveXObject("Msxml2.XMLHTTP"); 
			} 
	    catch (e) 
			{ 
	        try 
				{ 
	            http_request = new ActiveXObject("Microsoft.XMLHTTP"); 
				} 
			catch (e) {} 
			} 
		} 

	if (!http_request) 
		{ 
	    alert('Unfortunatelly you browser doesn\'t support this feature.'); 
	    return false; 
		} 
		
	http_request.onreadystatechange = function() 
		{ 
	    if (http_request.readyState == 4) 
			{ 
	        if (http_request.status == 200) 
				{ 
	            if (return_xml) 
					{ 
	                eval(callback_function + '(http_request.responseXML)'); 
					} 
					else 
					{ 
	                eval(callback_function + '(http_request.responseText)'); 
					} 
				} 
	        else 
				{ 
	            alert('There was a problem with the request.(Code: ' + http_request.status + ')'); 
				} 
			} 
		} 
	http_request.open('GET', url, true); 
	http_request.send(null); 
	}
	
function AJAXData(sCmd,sVal) 
	{ 
    if (sCmd) 
		{ 
	    var the_url = 'adminAJAX.ASP?type=' +  sCmd + '&command=' + escape(sVal) ; 
	    makeHttpRequest(the_url, 'printResult'); 
		}   
	}

function AJAXData2(sCmd,sVal) 
	{ 
    if (sCmd) 
		{ 
	    var the_url = '../adminAJAX.ASP?type=' +  sCmd + '&command=' + escape(sVal) ; 
	    makeHttpRequest(the_url, 'printResult'); 
		}   
	}
			
function printResult(result_string) 
	{ 
	var result_div = document.getElementById('result'); 
	//var result_array = result_string.split('\n'); 
	
	//add the request to the new document
	//var new_command = document.getElementById('command').value; 
	//result_div.appendChild(document.createTextNode(new_command)); 
	//result_div.appendChild(document.createElement('br')); 

	//for (var line_index in result_array) 
	//	{ 
	//	var result_wrap = document.createElement('pre') 
	//	line = document.createTextNode(result_array[line_index]); 
	//	result_wrap.appendChild(line); 
	//	result_div.appendChild(result_wrap); 
	//	result_div.appendChild(document.createElement('br')); 
	//	} 
		

	result_div.innerHTML = result_string;
	//document.getElementById('result').innerHTML += result_string;	
	//document.getElementById('result').innerHTML += 'SQL> ';	
	//result_div.appendChild(document.createTextNode('SQL> ')); 

	//result_div.scrollTop = result_div.scrollHeight; 
	//document.getElementById('command').value = ''; 
	
	var xBtn = document.getElementById('BTNDEF');
	if (xBtn!=null) 
		{
		xBtn.focus();
		}
	}
	
//********************************************************************
//     This group of functions is for the signup screen
//********************************************************************	
		
function AppSubmit()
	{
	DIVHide('DIVHELPSSN');
	DIVHide('DIVHELPPASS');
	DIVHide('DIVHELPUSER');
	DIVHide('DIVHELPEMAIL');
	REPO('DIVSTATUS');
	
	var sTemp = 'CUser=' + document.getElementById('CUser').value + '~~~';
	sTemp = sTemp + 'CPass=' + document.getElementById('CPass').value + '~~~';
	sTemp = sTemp + 'CPass2=' + document.getElementById('CPass2').value + '~~~';
	sTemp = sTemp + 'CSSN=' + document.getElementById('CSSN').value + '~~~';
	sTemp = sTemp + 'CCDate=' + document.getElementById('CCDate').value + '~~~';
	sTemp = sTemp + 'CStatus=' + document.getElementById('CStatus').value + '~~~';
	sTemp = sTemp + 'CSDate=' + document.getElementById('CSDate').value + '~~~';
	sTemp = sTemp + 'CParent=' + document.getElementById('CParent').value + '~~~';
	sTemp = sTemp + 'CType=' + document.getElementById('CType').value + '~~~';
	sTemp = sTemp + 'CLevel=' + document.getElementById('CLevel').value + '~~~';
	sTemp = sTemp + 'CEmail=' + document.getElementById('CEmail').value + '~~~';
	sTemp = sTemp + 'CFax=' + document.getElementById('CFax').value + '~~~';
	sTemp = sTemp + 'CCell=' + document.getElementById('CCell').value + '~~~';
	sTemp = sTemp + 'CPhone=' + document.getElementById('CPhone').value + '~~~';
	sTemp = sTemp + 'CCountry=' + document.getElementById('CCountry').value + '~~~';
	sTemp = sTemp + 'CStOther=' + document.getElementById('CStOther').value + '~~~';
	sTemp = sTemp + 'CZip=' + document.getElementById('CZip').value + '~~~';
	sTemp = sTemp + 'CCity=' + document.getElementById('CCity').value + '~~~';
	sTemp = sTemp + 'CAdd2=' + document.getElementById('CAdd2').value + '~~~';
	sTemp = sTemp + 'CAdd1=' + document.getElementById('CAdd1').value + '~~~';
	sTemp = sTemp + 'CState=' + document.getElementById('DState').value + '~~~';
	sTemp = sTemp + 'CCO=' + document.getElementById('CCO').value + '~~~';
	sTemp = sTemp + 'CImage=' + document.getElementById('CImage').value + '~~~';
	sTemp = sTemp + 'CData1=' + document.getElementById('CData1').value + '~~~';
	sTemp = sTemp + 'CData2=' + document.getElementById('CData2').value + '~~~';
	sTemp = sTemp + 'CWeb=' + document.getElementById('CWeb').value + '~~~';
	sTemp = sTemp + 'CFName=' + document.getElementById('CFName').value + '~~~';
	sTemp = sTemp + 'CLName=' + document.getElementById('CLName').value;

	AJAXData('USR',sTemp);
	}

//********************************************************************
//     This function Logs in to the back office, check the creds
//********************************************************************	
		
function AppLogin()
	{
	DIVHide('DIVHELP');
	var sTemp = 'Accessing Secure Server...<br>Validating User Information... &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><br>Please Wait...<br><br><center><input type="button" id="info" class="cssBtnDefault" value="Close" onClick="DIVHide(\'DIVLOGIN\');" onMouseOver="goLite(this.id)" onMouseOut="goDim(this.id)"></center>';
	printResult(sTemp);
	REPO('DIVLOGIN');
	
	var sTemp = 'CUser=' + document.getElementById('USER').value + '’';
	sTemp = sTemp + 'CPass=' + document.getElementById('PASS').value ;
	
	AJAXData('LOGIN',sTemp);
	
	}


//********************************************************************
//     This group is for the large content upload and download
//********************************************************************	
	
function CONT_ajaxLoad(sUSRID) 
	{
	//---------------------------------------
	//Gets the Text from the database
	//---------------------------------------
	//This is the drop down for the available content
	//alert('here I am');
	var selCON = document.getElementById('DContent');
	if (!selCON.value == '')
		{
		var ed = tinyMCE.get('DSPCONT');
		ed.setProgressState(1);
		//Update the hidden and current content fields
		document.getElementById('CCONTID').value = selCON.value;
		document.getElementById('CCONT').value = selCON.options[selCON.options.selectedIndex].text;
		var the_url = ' ';
		if (!sUSRID == '') 
			{
			the_url = 'adminAJAX.ASP?type=CLOAD&command=' + escape(selCON.value) + '&usr=' + sUSRID; 
			}
		else
			{
			the_url = 'adminAJAX.ASP?type=CLOAD&command=' + escape(selCON.value) + '&usr= '; 
			}
		makeHttpRequest(the_url, 'CONT_ajaxResult'); 
		}
	}

//Used for the temp user that we need to pass to the save reults
var sUSRTEMP = ''; 


function CONT_ajaxSaveResult(result_string) 
	{ 
	var aResult = new Array();
	aResult = result_string.split(' ');
	//alert(result_string);
	if (aResult[0] == 'SUCCESS')
		{
		CONT_Current = aResult[1];
		document.getElementById('CCONTID').value = CONT_Current;
		CONT_Send(sUSRTEMP);
		}
	else
		{
		alert('Save Error, Please try again!');
		alert(result_string);
		var ed = tinyMCE.get('DSPCONT');
		ed.setProgressState(0); // Hide progress
		sUSRTEMP = '';
		}
	}	

function CONT_ajaxSaveResultDone(result_string) 
	{ 
	var aResult = new Array();
	aResult = result_string.split(' ');
	if (aResult[0] == 'SUCCESS')
		{
		CONT_Current = aResult[1];
		document.getElementById('CCONTID').value = CONT_Current;
		alert('Content saved for ID #' + CONT_Current );
		sUSRTEMP = '';
		}
	else
		{
		alert('Save Error, Please try again!');
		alert(result_string);
		sUSRTEMP = '';
		}
	
	var ed = tinyMCE.get('DSPCONT');
	ed.setProgressState(0); // Hide progress
	//alert('why wont progress turn off?');
	}
	
function CONT_ajaxResult(result_string) 
	{ 
	var ed = tinyMCE.get('DSPCONT');
	ed.setContent(result_string);
	ed.setProgressState(0); // Hide progress
	//alert(result_string);
	}	


function CONT_Send(sUSRID)
	{
	CONT_Seq++;
	var the_url = ''; //empty place for the url
	
	//CONT_Received = false;
	if (CONT_Data.length > 1000)
		{
		var sTemp1k = CONT_Data.substr(0,1000); //place for the 1k
		sTemp1k = sTemp1k + '¬'
		CONT_Data = CONT_Data.substring(1000); // Cuts off the first 1000 characters.
		the_url = 'adminAJAX.ASP?type=CSAVE&command=' + escape(CONT_Current) + '&seq=' + CONT_Seq + '&desc=\'' + CONT_Desc + '\'&content=\'' + sTemp1k + '\'&usr=' + sUSRID + ' ' ; 
		makeHttpRequest(the_url, 'CONT_ajaxSaveResult');
		}
	else
		{
		the_url = 'adminAJAX.ASP?type=CSAVE&command=' + escape(CONT_Current) + '&seq=' + CONT_Seq + '&desc=\'' + CONT_Desc + '\'&content=\'' + CONT_Data + '¬\'&usr=' + sUSRID + ' ' ; 
		makeHttpRequest(the_url, 'CONT_ajaxSaveResultDone');
		}	
	}

function CONT_ajaxSave(sUSRID) 
	{
	var CCON = document.getElementById('CCONTID'); //Current Content ID
	if (!CCON.value == '')
		{
		var ed = tinyMCE.get('DSPCONT');
		ed.setProgressState(1);
		CONT_Desc = document.getElementById('CCONT').value.replace (/'/g, "''");
		CONT_Data = ed.getContent({format : 'text'}).replace(/&/g, "~amp~");
		CONT_Data = CONT_Data.replace(/©/g, "~cop~");
		CONT_Data = CONT_Data.replace(/'/g, "''");
		CONT_Data = CONT_Data.replace(/…/g, "...");
		CONT_Data = CONT_Data.replace(/’/g, "''");
		CONT_Data = CONT_Data.replace(/“/g, "\"");
		CONT_Data = CONT_Data.replace(/”/g, "\"");
		CONT_Data = CONT_Data.replace(/%/g, "»");
		CONT_Seq = 0; 
		CONT_Current = CCON.value;
		sUSRTEMP = sUSRID;
		CONT_Send(sUSRID);
		}
	
	//window.setTimeout(function() 
	//	{
	//	ed.setProgressState(0); // Hide progress
	//	alert(ed.getContent());
	//	}, 3000);
	}	
	

//********************************************************************
//    Allows a user to delete the content.  
//    ( set 2 = home page and they cannot delete it. )
//********************************************************************	

function CONT_ajaxDelete(sUSRID) 
	{
	var CCON = document.getElementById('CCONTID'); //Current Content ID
	var the_url = ''; //empty place for the url
		
	if (CCON.value == '')
		{
		alert('Can\'t delete this content');
		}	
	else
		{
		if (CCON.value == '2')
			{
			alert('This is your home page, it will be reset to the default content.');
			} 
		var ed = tinyMCE.get('DSPCONT');
		ed.setProgressState(1);
		
		the_url = 'adminAJAX.ASP?type=CDEL&command=' + CCON.value + '&usr=' + sUSRID + ' ' ; 
		makeHttpRequest(the_url, 'CONT_ajaxDelResultDone');
		
		}
	}	
	
function CONT_ajaxDelResultDone(result_string) 
	{ 
	var aResult = new Array();
	aResult = result_string.split(' ');
	if (aResult[0] == 'SUCCESS')
		{
		alert('Content Deleted');
		location.reload(true);
		}
	else
		{
		alert('Save Error, Please try again!');
		alert(result_string);
		}
	
	var ed = tinyMCE.get('DSPCONT');
	ed.setProgressState(0); // Hide progress
	//alert('why wont progress turn off?');
	}
	

//********************************************************************
//    Allows a user to create links within thier custom content.  
//    to their other custom content and system content
//********************************************************************	
	function ADDaLINK(sCont,sDesc,sUSR)
	{
	var ed = tinyMCE.get('DSPCONT');
	var sLink = '<a href="default.asp?Content=' + sCont + '&cUSR=' + sUSR + '">' + sDesc + '</a>';
	ed.execCommand( 'mceInsertContent', false, sLink);
	
	//ed.selection.setContent('<strong>Hello World</strong>');
	//ed.windowManager.alert('Must make a selection first for the Link');
	
	}
	
//********************************************************************
//    Allows a user to create links within thier custom content.  
//    to other things, like email
//********************************************************************	
	function ADD_LINK(sCont,sDesc)
	{
	var ed = tinyMCE.get('DSPCONT');
	var sLink = '<a href="' + sCont + '">' + sDesc + '</a>';
	ed.execCommand( 'mceInsertContent', false, sLink);
	
	//ed.selection.setContent('<strong>Hello World</strong>');
	//ed.windowManager.alert('Must make a selection first for the Link');
	
	}	

//********************************************************************
//   Opens a new window.  
//   Pass URL and a 1 if you want scroll bars
//********************************************************************	
	function ONewWin(sURL, bScroll, iWidth, iHeight )
	{
	var width;
	if(iWidth==null||iWidth==0)
		{
		width  = 665;
		}
	else
		{
		width  = iWidth;
		}
	var height;
	if(iHeight==null||iHeight==0)
		{
		height  = 420;
		}
	else
		{
		height  = iHeight;
		}
	var left   = (screen.width  - width)/2;
	var top    = (screen.height - height)/2;
	var params = 'width='+width+', height='+height;
	params += ', top='+top+', left='+left;
	//params += ', address=no';
	params += ', directories=no';
	params += ', location=no';
	params += ', menubar=no';
	params += ', resizable=no';
	if(bScroll==null||bScroll==0)
		{
		params += ', scrollbars=no';
		}
	else
		{
		params += ', scrollbars=yes';
		}
	params += ', status=no';
	params += ', toolbar=no';
		
    NEWWIN = window.open(sURL,'GOODCO',params);
	if (window.focus) 
	 	{
	 	NEWWIN.focus();
	 	}
	return false;
	}

//**********************************************
//         CHANGE the users Password	 \/   \/   
//**********************************************
function chgPass(sUSR)
	{
	var sPass1 = document.getElementById('CPass');
	var sPass2 = document.getElementById('CPass2');
	var sP1 = sPass1.value;
	var sP2 = sPass2.value;
	if (sP1==sP2)
		{
		var lngth = sP1.length;
		if (lngth < 5)
			{
			alert('Your password must be over 4 characters long.');
			sPass1.value = '';
			sPass2.value = '';
			sPass1.focus(); 
			}
		else
			{
			var the_url = 'adminAJAX.ASP?type=SETPASS&command=' + escape(sP1) + '&USR=' + sUSR; 
			makeHttpRequest(the_url, 'PassResult');
			}
		}
	else
		{
		alert('Error: \nPasswords do not match. Try again!');
		sPass1.value = '';
		sPass2.value = '';
		sPass1.focus(); 
		} 
	}	
	
function PassResult(result_string) 
	{ 
	var sPass1 = document.getElementById('CPass');
	var sPass2 = document.getElementById('CPass2');
	if (result_string=='GOOD')
		{
		alert('New Password Accepted!\nMake a note so you do not forget it.');
		sPass1.value = '';
		sPass2.value = '';
		DIVHide('DIVCHGPASS');
		}
	else
		{
		alert(result_string);
		sPass1.value = '';
		sPass2.value = '';
		sPass1.focus(); 
		}
	}	

//**********************************************
//         CHANGE the users Password	 /\   /\   
//**********************************************
		
		
function DelayONewWin(sURL)
	{
	setTimeout("ONewWin('" + sURL + "');",1000);
	}
function AJAXGetMenu(sVal) 
	{ 
	DIVHide('DIVMENU');
	var sTemp='Retrieving Menu and user rights from Server...<br><br>Please Wait...<br>'
	MenuResult(sTemp);
	REPO('DIVMENU');
	AJAXMenuData('MENU',sVal);
	setTimeout("DIVHide('DIVMENU');",20000);
	}
function AJAXMenuData(sCmd,sVal) 
	{ 
    if (sCmd) 
		{ 
	    var the_url = 'adminAJAX.ASP?type=' +  sCmd + '&command=' + escape(sVal) ; 
	    makeHttpRequest(the_url, 'MenuResult'); 
		}   
	}
		
function MenuResult(result_string) 
	{ 
	if (result_string.indexOf('~ASON~') > -1)
		{
		window.location='checkout.asp';
		return
		} 
	var Menu_div = document.getElementById('MenuResult'); 
	Menu_div.innerHTML = result_string;
	REPO('DIVMENU');
	}
	
function AJAXAutoOn() 
	{ 
	DIVHide('DIVMENU');
	var sTemp='Building your AutoShip order...<br><br>Please Wait...<br>'
	MenuResult(sTemp);
	REPO('DIVMENU');
	AJAXMenuData('AUTOS','ON');
	//setTimeout("DIVHide('DIVMENU');",20000);
	}
	
function AJAXAutoOff() 
	{ 
	DIVHide('DIVMENU');
	var sTemp='Confirm AutoShip Termination<br><br>Please Wait...<br>'
	MenuResult(sTemp);
	REPO('DIVMENU');
	AJAXMenuData('AUTOS','CONFIRM');
	setTimeout("DIVHide('DIVMENU');",20000);
	}
	
function AJAXAutoCONFIRM() 	
	{
	DIVHide('DIVMENU');
	var sTemp='Terminating Your AutoShip!<br><br>Please Wait...<br>'
	MenuResult(sTemp);
	REPO('DIVMENU');
	AJAXMenuData('AUTOS','OFF');
	setTimeout("DIVHide('DIVMENU');",20000);
	}
		
		
function change(cImage,picture) 
		{
		cImage.src = picture;
		}


function AJAXGetItemDTL(sVal) 
	{ 
	DIVHide('DIVADDCART');
	var sTemp='Retrieving Item Details from Server...<br><br>Please Wait...<br>';
	ItemDTLResult(sTemp);
	REPO('DIVADDCART');
	AJAXItemDTLData('ITMDTL',sVal);
	//setTimeout("DIVHide('DIVADDCART');",40000);
	}
	
function ItemDTLResult(result_string) 
	{ 
	var ADD_div = document.getElementById('ADDCARTResult'); 
	ADD_div.innerHTML = result_string;
	REPO('DIVADDCART');
	}

function ADD2CARTResult(result_string)
	{
	document.getElementById('ADDEDResult').innerHTML = result_string;
	}
	
function DisplayFormValues(sForm)//not used any more
	{
	var str = '';
	var elem = document.getElementById(sForm).elements;
	for(var i = 0; i < elem.length; i++)
		{
		str += "<b>Type:</b>" + elem[i].type + "&nbsp&nbsp";
		str += "<b>Name:</b>" + elem[i].name + "&nbsp;&nbsp;";
		str += "<b>ID:</b>" + elem[i].id + "&nbsp;&nbsp;";
		str += "<b>Value:</b><i>" + elem[i].value + "</i>&nbsp;&nbsp;";
		str += "<BR>";
		}
	alert(str); 
	//document.getElementById('ADDEDResult').innerHTML = str;
	}

function opacity(id, opacStart, opacEnd, millisec) 
	{ 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) 
		{ 
        for(i = opacStart; i >= opacEnd; i--) 
			{ 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
			} 
		} 
	else if(opacStart < opacEnd) 
		{ 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
			} 
		} 
	} 

//change the opacity for different browsers 
function changeOpac(opacity, id) 
	{ 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
	} 

function OpacLoop(cnt)
	{
	if (cnt==1)
		{
		opacity('NewMail', 100, 0, 500);
		setTimeout("OpacLoop(0);",2000);
		}
	else
		{
		opacity('NewMail', 0, 100, 500);
		setTimeout("OpacLoop(1);",1000);
		}
	}


//NEW FUNCTION to SET the Distributor
function AJAXSetDist(sDistNumber) 
	{ 
	if (sDistNumber) 
		{ 
	    var the_url = 'thegoodplanner/admin/adminAJAX.ASP?type=setDist&command=' + escape(sDistNumber) ; 
	    makeHttpRequest(the_url, 'sDistResult'); 
		}   
	}	
function sDistResult(result_string) 
	{
	//alert(result_string);
	}

