	/*********************************************************************
* Copyright 2009 Amblique :: www.amblique.com :: All Rights Reserved *
**********************************************************************
* JAVASCRIPT AND OTHER SCRIPTING
*********************************************************************/

/**********************************
* jQuery scripts
**********************************/
jQuery(document).ready(function() {

	// PopupWindow :: http://plugins.jquery.com/project/PopupWindow
	var profiles = {
		popupToolsPrint:{height:500,width:600,center:1,scrollbars:1,status:0,resizable:1},
		popupToolsEmail:{height:400,width:500,center:1,scrollbars:1,status:0,resizable:1},
		popupToolsCare:{height:500,width:700,center:1,scrollbars:1,status:0,resizable:1}
	};
	$(".tool").popupwindow(profiles);
	
	// Table Hover
    $(".table-compareplans, .table-b-hover").tableHover({colClass: 'hover', rowClass: '', headCols: true});
    $(".table-b-hover-row").tableHover({ colClass: '', rowClass: 'hover', headCols: true });

    // Table Last
    $(".table-b-last tr:last").addClass("last");
    
});

/**********************************
* Custom scripts
**********************************/

/***** Cufon *****/
Cufon.replace('.font, h3.heading-header, h2.contentTitle, h3.heading-home, h3.heading-signup, h3.heading-signupnow, h3.heading-welcome, h3.heading-box-d, h3.heading-findourrates');

/***** Google toolbar yellow fields Fix *****/
if(window.attachEvent)
window.attachEvent("onload",setListeners);

function setListeners(){
inputList = document.getElementsByTagName("INPUT");
for(i=0;i<inputList.length;i++){
	inputList[i].attachEvent("onpropertychange",restoreStyles);
	inputList[i].style.backgroundColor = "";
}
selectList = document.getElementsByTagName("SELECT");
	for(i=0;i<selectList.length;i++){
		selectList[i].attachEvent("onpropertychange",restoreStyles);
		selectList[i].style.backgroundColor = "";
	}
}
function restoreStyles(){
	if(event.srcElement.style.backgroundColor != "" && event.srcElement.style.backgroundColor != "#a0d0ff"){
		event.srcElement.style.backgroundColor = "#a0d0ff"; /* color of choice for AutoFill */
		document.all['googleblurb'].style.display = "block";
	}
}

/***** Clear Input Text *****/
function clearText(thefield, clearType){ 
	if (thefield.defaultValue==thefield.value) {
		thefield.value = ""
	}		
}

function ShowHideHomePageRandomContent(ElementIDToShow, NoOfRandomElementsOnPage, IndexToStartAt)
{
    for(var x=IndexToStartAt;x <= NoOfRandomElementsOnPage;x++)
    {
        var RandomElementDiv = document.getElementById('ccLitRandomContent' + x);
        if(RandomElementDiv)
            RandomElementDiv.className = (x==ElementIDToShow ? "contentRandom contentRandom" + ElementIDToShow : "contentRandom contentRandom" + ElementIDToShow + " hidden");
    }    
}
function SetCurrentHoverNavItem(NavPanelID, NewSelectedElement, SelectedClassName)
{
    //function is for panel bar nav item on home page, any element that is hovered over should be in selected mode, and set all other nav items to regular (unselected) css class
    var NavPanel = document.getElementById(NavPanelID);
    if(NavPanel)
    {
        //nav items will be anchor tags
        var AnchorElements = NavPanel.getElementsByTagName("a");
        for(var x=0; x < AnchorElements.length; x++)
        {
           //remove selected class from Nav Panel elements (if the selected class name is part of the element)
           AnchorElements[x].className = AnchorElements[x].className.replace(SelectedClassName, '');
        }
    }
    //add selected class to currently hovered nav item 
    NewSelectedElement.className += ' ' + SelectedClassName;
}


