
function speed(obj)
{
    if(obj.value == "1" || obj.value == "5")
    {
        speedLabel();
    }
    else
    {
        speedLabel1();
    }

}

function broadbandStatus(obj)
{
    if(obj.value == "3")
    {
        checkNoBroadband();
    }
}

function clickButton(e, buttonid){ 
      var bt = document.getElementById(buttonid); 
      if (typeof bt == 'object'){ 
            if(navigator.appName.indexOf("Netscape")>(-1)){ 
                  if (e.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ 
                  if (event.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
      } 
} 

function checkGender()
{
	var w = document.Form1["cboSalutation"].selectedIndex;
	var selectedText = document.Form1["cboSalutation"].options[w].text;	
	
	switch(selectedText)
	{
		case "DR":
			document.Form1.rdoGender_1.checked = false;
			document.Form1.rdoGender_0.checked = false;
			break;
	    case "Dr":
			document.Form1.rdoGender_1.checked = false;
			document.Form1.rdoGender_0.checked = false;
			break;
		case "Lady":
			document.Form1.rdoGender_0.checked = true;
			break;
		case "MISS":
			document.Form1.rdoGender_0.checked = true;
			break;
		case "MR":
			document.Form1.rdoGender_1.checked = true;
			break;	
		case "MRS":
			document.Form1.rdoGender_0.checked = true;
			break;
		case "MS":
			document.Form1.rdoGender_0.checked = true;
			break;
		case "MSTR":
			document.Form1.rdoGender_1.checked = true;
			break;	
		case "Miss":
			document.Form1.rdoGender_0.checked = true;
			break;
		case "Mr":
			document.Form1.rdoGender_1.checked = true;
			break;	
		case "Mrs":
			document.Form1.rdoGender_0.checked = true;
			break;
		case "Ms":
			document.Form1.rdoGender_0.checked = true;
			break;
		case "Mstr":
			document.Form1.rdoGender_1.checked = true;
			break;
		case "PROF":
			document.Form1.rdoGender_1.checked = false;
			document.Form1.rdoGender_0.checked = false;
			break;
		case "PSTR":
			document.Form1.rdoGender_1.checked = false;
			document.Form1.rdoGender_0.checked = false;
			break;
		case "Prof":
			document.Form1.rdoGender_1.checked = false;
			document.Form1.rdoGender_0.checked = false;
			break;
		case "Pstr":
			document.Form1.rdoGender_1.checked = false;
			document.Form1.rdoGender_0.checked = false;
			break;
		case "REV":
			document.Form1.rdoGender_1.checked = false;
			document.Form1.rdoGender_0.checked = false;
			break;
		case "Rev":
			document.Form1.rdoGender_1.checked = false;
			document.Form1.rdoGender_0.checked = false;
			break;
		case "Sir":
			document.Form1.rdoGender_1.checked = true;
			break;	
					
	}	
}

function toggleConfirm()
{
	if(document.Form1.rdoAgreement_0.checked)
	{
		document.Form1.rdoAgreement_0.checked = true;		
		document.Form1.cmdConfirm.disabled = false;
		document.Form1.cmdConfirm.focus();
	}
	else
	{
		document.Form1.rdoAgreement_1.checked = true;		
		document.Form1.cmdConfirm.disabled = true;
	}		
}
//-------------- created by Nikhil -------------------------------------------
//function to revert the cust back to the respective web page if they donot have broadband

 function checkNoBroadband()
 {
    //var index = document.Form1["cboBroadband"].selectedIndex;
    //var broadbandStatus = document.Form["cboBroadband"].options[index].text;
    
    //if(broadbandStatus == "No")
    //{
    //var element = document.getElementById("Label1");
    
        if(hotkey == "True")
        {
            //element.style.visibility = "hidden"; 
            //Label1.style.visibility = "hidden";         
            dvHotkey.style.display = "inline";	
            document.Form1.cmdNext.disabled = true;				
	        window.setTimeout('redirectHotkey()', 3000);
	        //document.Form1.Label1.Visible = false;
            //document.Form1.Label2.Visible = false;
            //document.Form1.Label3.Visible = false;
            //document.Form1.cboBroadbandSpeed.Visible = false;
            //document.Form1.cboBroadband.Visible = false;	
            //ques1.visible = false;
            //ques2.visible = false;
        }
        else if(hotkey == "False")
        {
            //element.style.display = "none";     
            dvPrimus.style.display = "inline";	
            document.Form1.cmdNext.disabled = true;		
	        window.setTimeout('redirectPrimus()', 3000);
	        document.Form1.Label1.Visible = false;
            document.Form1.Label2.Visible = false;
            document.Form1.Label3.Visible = false;
            document.Form1.cboBroadbandSpeed.Visible = false;
            document.Form1.cboBroadband.Visible = false;	
            ques1.visible = false;
            ques2.visible = false;
        }
    //}
}
//-----------------------------------------------------------------------------

function speedLabel()
        {
        
            var element = document.getElementById("labelSpeed");
            element.style.display = "inline";
            
        
            //var speedChosen = document.getElementById("cboBroadbandSpeed").value; 
            //var speedChosen = cboBroadbandSpeed.SelectedValue.ToString();
            //if (speedChosen == "Slow - (128kbps or less)")
            //{
                //LabelSpeed.Visible = true;
            //}
        }
        
 function speedLabel1()
        {
        
            var element = document.getElementById("labelSpeed");
            element.style.display = "none";
     
        }

function noPrimusBroadband()
{		
	dvPrimus.style.display = "inline";	
	document.Form1.cboISP.disabled = true;
	broadbandDetails.style.display = "none";
	noBroadbandModem.style.display = "none";	
	document.Form1.cmdNext.disabled = true;		
	window.setTimeout('redirectPrimus()', 3000);
}

function checkBroadbandModem(softphoneOnly)
{	
	var w = document.Form1["cboModemType"].selectedIndex;
	var selectedText = document.Form1["cboModemType"].options[w].text;	
	
	var selectedType = document.Form1["cboConnectionType"].selectedIndex;
	var selectedTypeText = document.Form1["cboConnectionType"].options[selectedType].text;
	
	if(!softphoneOnly)
	{
		if (selectedText == "Ethernet & USB")
		{
			showEthernetUSBType.style.display = "inline";				
		}
		else
		{
			showEthernetUSBType.style.display = "none";
		}
			
		if (selectedText == "USB only")
		{
			noBroadbandModem.style.display = "inline";
			document.Form1.cmdNext.disabled = true;
			return;
		}
		else
		{
			noBroadbandModem.style.display = "none";
			if(selectedTypeText == "Wireless" || selectedTypeText == "Satellite")
				document.Form1.cmdNext.disabled = true;
			else
				document.Form1.cmdNext.disabled = false;
		}
	}	
}

function toggleContractLength(display)
{
	contractLengthLabel.style.display = display;
	contractLength.style.display = display;
}

function toggleAmexDetail()
{
	var selectedCard = document.Form1["cboCardType"].selectedIndex;
	var selectedText = document.Form1["cboCardType"].options[selectedCard].text;
	var toggle;
	
	if(selectedText == "American Express")
		toggle = "inline";
	else
		toggle = "none";		
	
	amexLabel.style.display = toggle;
	amexStar.style.display = toggle;
	amexText.style.display = toggle;
	amexValidator.style.display = toggle;	
}

function toggleBillingAddress()
{
	var isChecked = document.Form1.chkBilling.checked;
	var toggle;
	
	if(isChecked == true)
		toggle = "none";
	else
		toggle = "inline";		
	
	billingAddressStreetNoLabel.style.display = toggle;
	billingAddressStreetNoValue.style.display = toggle;
	billingAddressStreetLabel.style.display = toggle;
	billingAddressStreetValue.style.display = toggle;
	billingAddressSuburbLabel.style.display = toggle;
	billingAddressSuburbValue.style.display = toggle;
	billingAddressStateLabel.style.display = toggle;
	billingAddressStateValue.style.display = toggle;
	billingAddressPostcodeLabel.style.display = toggle;
	billingAddressPostcodeValue.style.display = toggle;
}

function toggleShippingAddress()
{
	var isChecked = document.Form1.chkShipping.checked;
	var toggle;
	
	if(isChecked == true)
		toggle = "none";
	else
		toggle = "inline";		
	
	shippingAddressStreetNoLabel.style.display = toggle;
	shippingAddressStreetNoValue.style.display = toggle;
	shippingAddressStreetLabel.style.display = toggle;
	shippingAddressStreetValue.style.display = toggle;
	shippingAddressSuburbLabel.style.display = toggle;
	shippingAddressSuburbValue.style.display = toggle;
	shippingAddressStateLabel.style.display = toggle;
	shippingAddressStateValue.style.display = toggle;
	shippingAddressPostcodeLabel.style.display = toggle;
	shippingAddressPostcodeValue.style.display = toggle;
}

function noPrimusBroadband()
{		
	dvPrimus.style.display = "inline";	
	document.Form1.cboISP.disabled = true;
	broadbandDetails.style.display = "none";
	noBroadbandModem.style.display = "none";	
	document.Form1.cmdNext.disabled = true;		
	window.setTimeout('redirectPrimus()', 3000);
}

function redirectPrimus()
{
	window.location = "http://www.primus.com.au/PrimusWeb/HomeSolutions/BroadbandInternet";
}

function noHotkeyBroadband()
{
	dvHotkey.style.display = "inline";	
	document.Form1.cboISP.disabled = true;
	broadbandDetails.style.display = "none";
	noBroadbandModem.style.display = "none";	
	document.Form1.cmdNext.disabled = true;				
	window.setTimeout('redirectHotkey()', 3000);	
}

function redirectHotkey()
{
	window.location = "https://registration.hotkey.net.au";
}

function toggleNoBroadbandError(display, isPrimus)
{
	if (display == "none")
	{
		if (isPrimus)
		{
			document.Form1.cboISP.disabled = true;
			broadbandDetails.style.display = "inline";	
			document.Form1.cmdNext.disabled = false;
			document.Form1.cboBroadbandSpeed.focus();
		}
		else
		{
			document.Form1.cboISP.disabled = false;
			document.Form1.cboISP.focus();
			broadbandDetails.style.display = "inline";		
			document.Form1.cmdNext.disabled = false;
		}
	}	
}

function toggleBroadbandInfo(display)
{
    if(display == "n")
    {
        document.Form1.cmdNext.disabled = false;
        broadbandDetails.style.display = "inline";
    }
}

function redirectNoBroadband()
{
	window.location = "http://www.iprimus.com.au/broadband";
}

function checkConnectionType(softphoneOnly)
{
	var w = document.Form1["cboModemType"].selectedIndex;
	var selectedText = document.Form1["cboModemType"].options[w].text;	
	
	var selectedType = document.Form1["cboConnectionType"].selectedIndex;
	var selectedTypeText = document.Form1["cboConnectionType"].options[selectedType].text;
	
	if((selectedTypeText == "ADSL") || (selectedTypeText == "Cable"))
	{
		document.Form1.txtPhoneNumber.disabled = false;	
		document.Form1.txtPhoneNumber.focus();
		
		if(!softphoneOnly)
		{
			if(selectedText == "USB only")
			{
				document.Form1.cmdNext.disabled = true;
			}
			else
			{
				document.Form1.cmdNext.disabled = false;
			}
		}	
		else
		{			
			document.Form1.cmdNext.disabled = false;
		}
		showInvalidConnectionType.style.display = "none";
		return;
	}	
		
	if(selectedTypeText == "Wireless" || selectedTypeText == "Satellite")
	{
		document.Form1.cmdNext.disabled = true;	
		document.Form1.txtPhoneNumber.disabled = true;
		showInvalidConnectionType.style.display = "inline";
	}		
}

function openHelp(anchor) 
{ 
	var w = 600;
	var h = 600;
	
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;    
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+' resizable=1 scrollbars=yes'
	window.open("Help/Help.htm" + anchor, "", winprops)
	return false;
} 

function openWindow(win) 
{ 
	var w = 600;
	var h = 600;
	
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;    
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+' resizable=1 scrollbars=yes'
	window.open(win, "", winprops)
	return false;
} 

function openWindowForPrint(win) 
{ 
	var w = 400;
	var h = 300;
	
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;    
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+' resizable=1 scrollbars=yes'
	window.open(win, "", winprops)
	return false;
}

function printWindow()
{
	window.print();
}

function showToolTip(e,text)
{
    document.all.ToolTip.innerHTML="<table><tr><td class=ToolTipTD>"+text+"</td></tr><tr><td class=ToolTipTD>"+text+"</td></tr></table>"; 
    ToolTip.style.pixelLeft=(e.x+15+document.body.scrollLeft);
    ToolTip.style.pixelTop=(e.y+document.body.scrollTop); 
    ToolTip.style.visibility="visible"; 
} 

function hideToolTip()
{
    ToolTip.style.visibility="hidden"; 
}
