function hoverAboutOn()
{
	document.getElementById("menu_about").style.backgroundImage="url(images/menuh_about.png)";
}
function hoverAboutOff()
{
	document.getElementById("menu_about").style.backgroundImage="url(images/menu_about.png)";
}

function hoverProductsOn()
{
	document.getElementById("menu_products").style.backgroundImage="url(images/menuh_products.png)";
}
function hoverProductsOff()
{
	document.getElementById("menu_products").style.backgroundImage="url(images/menu_products.png)";
}

//enable poll vote button
function enableVoteButton()
{
	document.getElementById("votebutton").disabled = false;
}

//step-by-step support wizard
function doSupportStep2()
{
	document.getElementById("step2").style.display="block";
	document.getElementById("step1").style.display="none";
}

function doSupportStep3()
{
	var adslordialup = document.getElementById('adslordialupbox').value;
	if (adslordialup == 1)
	{
		//blank out step 2
		document.getElementById("step2").style.display="none";
		//show step 3
		document.getElementById("step3").style.display="block";
	}
	else
	{
		//blank out step 2
		document.getElementById("step2").style.display="none";
		//compile user data
		var emailaccountid = document.getElementById('emailaccountid').value;
		var html;
		
		//datapro capetown
		if (emailaccountid == "ct")
		{
			html = "<h2>Your Email Settings Are:</h2>POP3 (Incoming Email) Server:<br>ct.stormnet.co.za<p>SMTP (Outgoing Email) Server:<br>ct.stormnet.co.za";
		}
		
		//datapro durban
		if (emailaccountid == "dbn")
		{
			html = "<h2>Your Email Settings Are:</h2>POP3 (Incoming Email) Server:<br>dbn.stormnet.co.za<p>SMTP (Outgoing Email) Server:<br>dbn.stormnet.co.za";
		}
		
		//datapro jhb
		if (emailaccountid == "jhb")
		{
			html = "<h2>Your Email Settings Are:</h2>POP3 (Incoming Email) Server:<br>jhb.stormnet.co.za<p>SMTP (Outgoing Email) Server:<br>jhb.stormnet.co.za";
		}
		
		//is sosdns
		if (emailaccountid == "sosdns")
		{
			html = "<h2>Your Email Settings Are:</h2>POP3 (Incoming Email) Server:<br>vmail.dial-up.net<p>SMTP (Outgoing Email) Server:<br>vmail.dial-up.net";
		}
		
		//show result box
		document.getElementById("result").style.display="block";
		//place details into result box
		document.getElementById("result").innerHTML=html;
	}
}

function doSupportStep4()
{
	//blank out step 3
	document.getElementById("step3").style.display="none";
	//compile user data
	var adslaccountid = document.getElementById('adslaccountid').value;
	var emailaccountid = document.getElementById('emailaccountid').value;
	var html;
	
	html = "<h2>Your Email Account Settings Are:</h2>";
	//datapro capetown pop3
	if (emailaccountid == "ct")
		html = html + "POP3 (Incoming Email) Server:<br>ct.stormnet.co.za<p>";
	//datapro durban pop3
	if (emailaccountid == "dbn")
		html = html + "POP3 (Incoming Email) Server:<br>dbn.stormnet.co.za<p>";
	//datapro jhb pop3
	if (emailaccountid == "jhb")
		html = html + "POP3 (Incoming Email) Server:<br>jhb.stormnet.co.za<p>";
	//is sosdns pop3
	if (emailaccountid == "sosdns")
		html = html + "POP3 (Incoming Email) Server:<br>vmail.dial-up.net<p>";
	
	//isdsl
	if (adslaccountid == "isdsl")
		html = html + "SMTP (Outgoing Email) Server:<br>smtp.isdsl.net<p>";
	//isdsl
	if (adslaccountid == "sosdsl")
		html = html + "SMTP (Outgoing Email) Server:<br>smtp.saix.net<p>";
	
	//show result box
	document.getElementById("result").style.display="block";
	//place details into result box
	document.getElementById("result").innerHTML=html;
}
//end step-by-step support wizard


//webmail router
function selectWebmail()
{
	document.getElementById("webmail_chooser").style.display="none";
	var webmailform = document.getElementById('accountname').value;
	if (webmailform == "ct")
		document.getElementById("ct_form").style.display="block";
	if (webmailform == "dbn")
		document.getElementById("dbn_form").style.display="block";
	if (webmailform == "jhb")
		document.getElementById("jhb_form").style.display="block";
	if (webmailform == "sosdns")
		document.getElementById("sosdns_form").style.display="block";
}
function addServer(server)
{
	//capetown
	if (server == "ct")
	{
		var currentuser = document.ct_form.user.value;
		document.ct_form.user.value = currentuser + "@ct.stormnet.co.za";
		document.getElementById("ct_form").style.display="none";
		document.getElementById("redirection_message").style.display="block";
	}
	//durban
	if (server == "dbn")
	{
		var currentuser = document.ct_form.user.value;
		document.ct_form.user.value = currentuser + "@dbn.stormnet.co.za";
		document.getElementById("dbn_form").style.display="none";
		document.getElementById("redirection_message").style.display="block";
	}
	//jhb
	if (server == "jhb")
	{
		var currentuser = document.ct_form.user.value;
		document.ct_form.user.value = currentuser + "@jhb.stormnet.co.za";
		document.getElementById("jhb_form").style.display="none";
		document.getElementById("redirection_message").style.display="block";
	}
}

//end webmail router

//my links
function showMyLinksForm()
{
	document.getElementById("mylinksadd").style.display="block";
}

var xmlHttp;

function addMyLink(str)
{
	if (str.length==0)
  	{ 
  		document.getElementById("chooseform_div").innerHTML="";
  		return;
  	}
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request");
  		return;
  	}
	//get form values
	var title = document.getElementById('myLinksTitle').value;
	var address = document.getElementById('myLinksURL').value;
	
	var url="process.asp?do=addmylink";
	url=url+"&title="+title;
	url=url+"&address="+address;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{ 
 		document.getElementById("MyLinksBlock").innerHTML=xmlHttp.responseText;
		//refreshRequest();
 	} 
}

//submit contact form
function submitContactForm(str)
{
	if (str.length==0)
  	{ 
  		document.getElementById("contact_form").innerHTML="";
  		return;
  	}
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request");
  		return;
  	}
	//get form values
	var fname = document.getElementById('fname').value;
	var email = document.getElementById('email').value;
	var telc = document.getElementById('telc').value;
	var telno = document.getElementById('telno').value;
	var faxc = document.getElementById('faxc').value;
	var faxno = document.getElementById('faxno').value;
	if (document.getElementById('accesschk').checked)
		var accesschk = "Yes";
	if (document.getElementById('macchk').checked)
		var macchk = "Yes";
	if (document.getElementById('netchk').checked)
		var netchk = "Yes";
	if (document.getElementById('pcchk').checked)
		var pcchk = "Yes";
	if (document.getElementById('webchk').checked)
		var webchk = "Yes";
	var otherinterest = document.getElementById('otherinterest').value;
	var commsug = document.getElementById('commsug').value;
	
	var url="process.asp?do=sendcontactform";
	url=url+"&fname="+fname;
	url=url+"&email="+email;
	url=url+"&telc="+telc;
	url=url+"&telno="+telno;
	url=url+"&faxc="+faxc;
	url=url+"&faxno="+faxno;
	url=url+"&accesschk="+accesschk;
	url=url+"&macchk="+macchk;
	url=url+"&netchk="+netchk;
	url=url+"&pcchk="+pcchk;
	url=url+"&webchk="+webchk;
	url=url+"&otherinterest="+otherinterest;
	url=url+"&commsug="+commsug;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateCFormChanged;
	//image
	document.getElementById("contact_form").innerHTML="";
	var img = document.createElement('img');
	img.src = 'images/loading.gif';
	contact_form.appendChild(img);
	//close image
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateCFormChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{ 
 		document.getElementById("contact_form").innerHTML=xmlHttp.responseText;
 	} 
}

//submit poll
function submitPoll(str)
{
	if (str.length==0)
  	{ 
  		document.getElementById("poll").innerHTML="";
  		return;
  	}
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request");
  		return;
  	}
	//get form values
	var id = document.getElementById('pollid').value;
	if (document.getElementById('option1').checked)
		var option = "1";
	if (document.getElementById('option2').checked)
		var option = "2";
	if (document.getElementById('option3').checked)
		var option = "3";
	if (document.getElementById('option4').checked)
		var option = "4";

	var url="process.asp?do=vote";
	url=url+"&option="+option;
	url=url+"&id="+id;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=statePollChanged;
	//image
	document.getElementById("poll").innerHTML="";
	var img = document.createElement('img');
	img.src = 'images/loading.gif';
	document.getElementById("poll").appendChild(img);
	//close image
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function statePollChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{ 
 		document.getElementById("poll").innerHTML=xmlHttp.responseText;
 	} 
} 

//ajax general
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
 	{
 		// Firefox, Opera 8.0+, Safari
 		xmlHttp=new XMLHttpRequest();
 	}
	catch (e)
 	{
 		// Internet Explorer
 		try
  		{
  			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  		}
 		catch (e)
  		{
  			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  		}
 	}
	return xmlHttp;
}
