var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage,myname,settings);}

function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}

function goToEnergyComparison(){	
  page  = "http://energy.ucompare.net/";
  window.open(page, "win1","location=no,menubar=no,status=yes,resizable=yes,width=800,height=720,left=0,top=0,scrollbars=yes");
}

function goToCompareDuelFuel(){	
  page  = "http://energy.ucompare.net/calc_comparison.html?db=dual&referId=ucompare";
  window.open(page, "win1","location=no,menubar=no,status=yes,resizable=yes,width=800,height=720,left=0,top=0,scrollbars=yes");
}

function goToCompareGas(){	
  page  = "http://energy.ucompare.net/calc_comparison.html?db=gas&referId=ucompare";
  window.open(page, "win1","location=no,menubar=no,status=yes,resizable=yes,width=800,height=720,left=0,top=0,scrollbars=yes");
}

function goToCompareElectricity(){	
  page  = "http://energy.ucompare.net/calc_comparison.html?db=electric&greencalc=no&&referId=ucompare";
  window.open(page, "win1","location=no,menubar=no,status=yes,resizable=yes,width=800,height=720,left=0,top=0,scrollbars=yes");
}

function goToCompareGreenEnergy(){	
  page  = "http://energy.ucompare.net/calc_comparison.html?db=electric&greencalc=yes&&referId=ucompare";
  window.open(page, "win1","location=no,menubar=no,status=yes,resizable=yes,width=800,height=720,left=0,top=0,scrollbars=yes");
}

function goToEnergyPriceUpdates(){	
  page  = "http://energy.ucompare.net/energy_price_updates.html";
  window.open(page, "win1","location=no,menubar=no,status=yes,resizable=yes,width=800,height=720,left=0,top=0,scrollbars=yes");
}

function goToTravelComparison(){	
  page  = "http://www.ucompare.net/travel/comparison/";
  window.open(page, "win1","location=no,menubar=no,status=yes,resizable=yes,width=820,height=720,left=0,top=0,scrollbars=yes");
}

function goToLoanCalculator(){	
  page  = "/loans/calculator.html";
  window.open(page, "win1","location=no,menubar=no,status=no,resizable=yes,width=330,height=320,left=0,top=0,scrollbars=no");
}

function goToMortgageCalculator(){	
  page  = "/mortgages/calculator.html";
  window.open(page, "win1","location=no,menubar=no,status=no,resizable=yes,width=330,height=320,left=0,top=0,scrollbars=no");
}

function go(what) {
    var chosen = false;
    for (var i=0; i<3; i++) {
        if (what.sameName[i].checked == true) {
            chosen = true;
            location.href = what.sameName[i].value;
        }
    }
    if (!chosen)
        location.href = '/money/';
}
 




function Morgcal()
{
	form = document.myform
	LoanAmount= form.LoanAmount.value
		
	DownPayment= "0"
	AnnualInterestRate = form.InterestRate.value/100
	Years= form.NumberOfYears.value
		MonthRate=AnnualInterestRate/12
	NumPayments=Years*12
	Prin=LoanAmount-DownPayment
	
	MonthPayment=Math.floor((Prin*MonthRate)/(1-Math.pow((1+MonthRate),(-1*NumPayments)))*100)/100
		form.NumberOfPayments.value=NumPayments
	form.MonthlyPayment.value=MonthPayment
}
function TimStatus(message)
{
    window.status=message;
}
function SetStatus(message)
{
    window.status=message;
    setTimeout('TimStatus("'+message+'")',1);
}

function openWindow3(tURL,tWin) {
     window.open(tURL,tWin,'width=400,height=600,scrollbars=yes')
    }

function add_category()
					{
					if(document.form1.cats.value!=0)
					{
					var id=document.form1.cats.selectedIndex;
///-------
					var cid_list=form1.cid_list.value.split(";");
					var cnt=0;
					var posted="no";
					while(cnt<cid_list.length)
					{
						if(cid_list[cnt]==document.form1.cats.value)
						{ posted="yes";}
						cnt++;
						}
						if(posted=="yes")
						{
						alert('This category is already in the list');
						return false;
					}

//----------
					if(document.form1.category.value=="")
					{
					document.form1.cid_list.value=document.form1.cats.value;
					document.form1.category.value=document.form1.cats.options[id].text;
					document.form1.category.focus();
					document.form1.cats.selectedIndex=0;
					}
					else
					{
					document.form1.cid_list.value=document.form1.cid_list.value+";"+document.form1.cats.value;
					document.form1.category.value=document.form1.category.value+";"+document.form1.cats.options[id].text;
					document.form1.category.focus();
					document.form1.cats.selectedIndex=0;
					}
					}
					else
					{
					alert('Choose a Category to add!');
					}
					}
					
					function remove_category()
					{
					var s1=window.document.form1.category.value;
					var s2=s1.split(";");
					var i=0;
					var id=document.form1.cats.selectedIndex;
					var s3=document.form1.cats.options[id].text;
					
					var id_list=document.form1.cid_list.value;
					var id_split=id_list.split(";");
					var rem_id=document.form1.cats.value;
										
					window.document.form1.category.value="";
					window.document.form1.cid_list.value="";
					
					while(i<s2.length)
					{
					//alert('Checking '+s2[i]+' nnn  with'+s3+' mm');
						if(s3==s2[i])
						{
						//continue;
						//	alert('Removing'+s3);
						}
						else
						{
							if(document.form1.category.value=="")
							{
							document.form1.category.value=s2[i];
							}
							else
							{
							document.form1.category.value=document.form1.category.value+";"+s2[i];
							}
						
						}
						if(rem_id==id_split[i])
						{
						//continue;
						//	alert('Removing'+s3);
						}
						else
						{
							if(document.form1.cid_list.value=="")
							{
							document.form1.cid_list.value=id_split[i];
							}
							else
							{
							document.form1.cid_list.value=document.form1.cid_list.value+";"+id_split[i];
							}
						
						}
					i++;
					}
					//window.document.form1.related.value="";
					//window.document.form1.rel_id.value="";
					}

	function disk_space(frm)
	{
		//if(frm.dspace[1].checked==true)
		frm.dspacet.value='';
		//else
		//frm.dspacet.disabled=true;
	}
	function monthly(frm)
	{
		//if(frm.mpbelow[1].checked==true)
		frm.mpbelowt.value='';
		//else
		//frm.mpbelowt.disabled=true;
	}
	function subdomain(frm)
	{
		//if(frm.sdomain[1].checked==true)
		frm.sdomaint.value='';
		//else
		//frm.sdomaint.disabled=true;
	}

	function fee_setup(frm)
	{
		//if(frm.fsetup[1].checked==true)
		frm.fsetupt.value='';		//else
	//	frm.fsetupt.disabled=true;
	}
	function database(frm)
	{
//		if(frm.dbspace[1].checked==true)
		frm.dbspacet.value='';
	//	else
		//frm.dbspacet.disabled=true;
	}
	function transfer(frm)
	{
		//if(frm.dtrate[1].checked==true)
		frm.dtratet.value='';
		//else
		//frm.dtratet.disabled=true;
	}
	function emailaccount(frm)
	{
		//if(frm.email[1].checked==true)
		frm.emailt.value='';
		//else
		//frm.emailt.disabled=true;
	}
	function noofdata(frm)
	{
		//if(frm.nofdatabase[1].checked==true)
		frm.nofdatabaset.value='';
		//else
		//frm.nofdatabaset.disabled=true;
	}
	function enable_mpb(frm)
	{
		//if(frm.nofdatabaset.disabled==false)
		frm.mpbelow[1].checked=true
		frm.mpbelowt.disabled=false;
		//else
		//frm.nofdatabaset.disabled=true;
	}
	function enable_nodb(frm)
	{
		//if(frm.nofdatabaset.disabled==false)
		frm.nofdatabase[1].checked=true
		frm.nofdatabaset.disabled=false;
		//else
		//frm.nofdatabaset.disabled=true;
	}
	function enable_email(frm)
	{
		//if(frm.nofdatabaset.disabled==false)
		frm.email[1].checked=true
		frm.emailt.disabled=false;
		//else
		//frm.nofdatabaset.disabled=true;
	}
	function enable_dtr(frm)
	{
		//if(frm.nofdatabaset.disabled==false)
		frm.dtrate[1].checked=true
		frm.dtratet.disabled=false;
		//else
		//frm.nofdatabaset.disabled=true;
	}
	function enable_datsp(frm)
	{
		//if(frm.nofdatabaset.disabled==false)
		frm.dbspace[1].checked=true
		frm.dbspacet.disabled=false;
		//else
		//frm.nofdatabaset.disabled=true;
	}
	function enable_sub(frm)
	{
		//if(frm.nofdatabaset.disabled==false)
		frm.sdomain[1].checked=true
		frm.sdomaint.disabled=false;
		//else
		//frm.nofdatabaset.disabled=true;
	}
	function enable_fee(frm)
	{
		//if(frm.nofdatabaset.disabled==false)
		frm.fsetup[1].checked=true
		frm.fsetupt.disabled=false;
		//else
		
	//frm.nofdatabaset.disabled=true;
	}function enable_disk(frm)
	{
		//if(frm.nofdatabaset.disabled==false)
		frm.dspace[1].checked=true
		frm.dspacet.disabled=false;
		//else
		
	//frm.nofdatabaset.disabled=true;
	}
	
	function validate(form)
	{	
		if((form.mpbelow[1].checked==true) && (form.mpbelowt.value==""))
		{
		alert("Please provide value for Monthly Fee");
			form.mpbelowt.focus();
			return false;
		}
		if((form.dspace[1].checked==true) && (form.dspacet.value==""))
		{
		alert("Please provide value for Disk Space");
			form.dspacet.focus();
			return false;
		}
		
		if((form.sdomain[1].checked==true) && (form.sdomaint.value==""))
		{
		alert("Please provide value for Sub Domain");
			form.sdomaint.focus();
			return false;
		}
		if((form.fsetup[1].checked==true) && (form.fsetupt.value==""))
		{
		alert("Please provide value for Setup Fee  ");
			form.fsetupt.focus();
			return false;
		}
		if((form.dbspace[1].checked==true) && (form.dbspacet.value==""))
		{
		alert("Please provide value for  Database Space ");
			form.dbspacet.focus();
			return false;
		}
		if((form.dtrate[1].checked==true) && (form.dtratet.value==""))
		{
		alert("Please provide value for Bandwidth");
			form.dtratet.focus();
			return false;
		}
		
		if((form.nofdatabase[1].checked==true) && (form.nofdatabaset.value==""))
		{
		alert("Please provide value for  Number of Databases");
			form.nofdatabaset.focus();
			return false;
		}
		if((form.email[1].checked==true) && (form.emailt.value==""))
		{
		alert("Please provide value for  Email Accounts ");
			form.emailt.focus();
			return false;
		}
		
	return true;
}

function leapTo (link)
   {
   var new_url=link;
   if (  (new_url != "")  &&  (new_url != null)  )
      window.location=new_url;
   else
      alert("\nYou must make a selection.");
   }

function viewSource()
   {
   var current_url="";
   current_url=document.location;
   window.location="view-source:"+current_url;
   }

function showlaptop(theTable)
{
      if (document.getElementById(theTable).style.display == 'none')
      {
            document.getElementById(theTable).style.display = 'block';
      }
}

function hidelaptop(theTable)
{
      if (document.getElementById(theTable).style.display == 'none')
      {
            document.getElementById(theTable).style.display = 'none';
      }
      else
      {
            document.getElementById(theTable).style.display = 'none';
      }
}

function help_popup(form,context)
{
var file="help_popup.php?form=" + form+"&context="+context;
window.open(file,"Help","top=5,left=30,toolbars=no,maximize=yes,resize=yes,width=550,height=200,location=no,directories=no,scrollbars=yes");
}

<!--
function sb_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function help_popup(form,context)
{
var file="help_popup.php?form=" + form+"&context="+context;
window.open(file,"Help","top=5,left=30,toolbars=no,maximize=yes,resize=yes,width=550,height=200,location=no,directories=no,scrollbars=yes");
}

function openTarget (form, features, windowName) {
  if (!windowName)
    windowName = 'formTarget' + (new Date().getTime());
  form.target = windowName;
  open ('', windowName, features);
}

//** Tab Content script- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Last updated: Nov 8th, 06

var enabletabpersistence=1 //enable tab persistence via session only cookies, so selected tab is remembered?

////NO NEED TO EDIT BELOW////////////////////////
var tabcontentIDs=new Object()

function expandcontent(linkobj){
var ulid=linkobj.parentNode.parentNode.id //id of UL element
var ullist=document.getElementById(ulid).getElementsByTagName("li") //get list of LIs corresponding to the tab contents
for (var i=0; i<ullist.length; i++){
ullist[i].className=""  //deselect all tabs
if (typeof tabcontentIDs[ulid][i]!="undefined") //if tab content within this array index exists (exception: More tabs than there are tab contents)
document.getElementById(tabcontentIDs[ulid][i]).style.display="none" //hide all tab contents
}
linkobj.parentNode.className="selected"  //highlight currently clicked on tab
document.getElementById(linkobj.getAttribute("rel")).style.display="block" //expand corresponding tab content
saveselectedtabcontentid(ulid, linkobj.getAttribute("rel"))
}

function expandtab(tabcontentid, tabnumber){ //interface for selecting a tab (plus expand corresponding content)
var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber]
if (thetab.getAttribute("rel"))
expandcontent(thetab)
}

function savetabcontentids(ulid, relattribute){// save ids of tab content divs
if (typeof tabcontentIDs[ulid]=="undefined") //if this array doesn't exist yet
tabcontentIDs[ulid]=new Array()
tabcontentIDs[ulid][tabcontentIDs[ulid].length]=relattribute
}

function saveselectedtabcontentid(ulid, selectedtabid){ //set id of clicked on tab as selected tab id & enter into cookie
if (enabletabpersistence==1) //if persistence feature turned on
setCookie(ulid, selectedtabid)
}

function getullistlinkbyId(ulid, tabcontentid){ //returns a tab link based on the ID of the associated tab content
var ullist=document.getElementById(ulid).getElementsByTagName("li")
for (var i=0; i<ullist.length; i++){
if (ullist[i].getElementsByTagName("a")[0].getAttribute("rel")==tabcontentid){
return ullist[i].getElementsByTagName("a")[0]
break
}
}
}

function initializetabcontent(){
for (var i=0; i<arguments.length; i++){ //loop through passed UL ids
if (enabletabpersistence==0 && getCookie(arguments[i])!="") //clean up cookie if persist=off
setCookie(arguments[i], "")
var clickedontab=getCookie(arguments[i]) //retrieve ID of last clicked on tab from cookie, if any
var ulobj=document.getElementById(arguments[i])
var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL
for (var x=0; x<ulist.length; x++){ //loop through each LI element
var ulistlink=ulist[x].getElementsByTagName("a")[0]
if (ulistlink.getAttribute("rel")){
savetabcontentids(arguments[i], ulistlink.getAttribute("rel")) //save id of each tab content as loop runs
ulistlink.onclick=function(){
expandcontent(this)
return false
}
if (ulist[x].className=="selected" && clickedontab=="") //if a tab is set to be selected by default
expandcontent(ulistlink) //auto load currenly selected tab content
}
} //end inner for loop
if (clickedontab!=""){ //if a tab has been previously clicked on per the cookie value
var culistlink=getullistlinkbyId(arguments[i], clickedontab)
if (typeof culistlink!="undefined") //if match found between tabcontent id and rel attribute value
expandcontent(culistlink) //auto load currenly selected tab content
else //else if no match found between tabcontent id and rel attribute value (cookie mis-association)
expandcontent(ulist[0].getElementsByTagName("a")[0]) //just auto load first tab instead
}
} //end outer for loop
}


function getCookie(Name){ 
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return ""
}

function setCookie(name, value){
document.cookie = name+"="+value //cookie value is domain wide (path=/)
}