// http://www.cmsgeeks.com
// Written by John Jacks (john@NOSPAMkcmsgeeks.com - remove NOSPAM)
// version 1.0

<!--
function showMenu(pageObj,callerObj){
	var docObj= document.getElementById(pageObj);
	if(docObj){
		if(docObj.style.display == "none"){
			docObj.style.display = "block"; 
			callerObj.className = "topCatLinkSel";
		} else {
			docObj.style.display = "none"; 
			callerObj.className = "topCatLink";
		}
	}

}

function initMenu(divIdArr,divToShow,topDiv){
	for(var i = 0; i<divIdArr.length; i++){ 
		var docObj = document.getElementById(divIdArr[i]);
		if(docObj){
			if(divToShow && divToShow == divIdArr[i]){ 
				document.getElementById(topDiv).className = "topCatLinkSel";
			} else { 
				docObj.style.display = "none"; 
			}
		}
	}
}



var emailRegExp = new RegExp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", "i");	

function doForgot(formObj){
	formObj.forgot.value='true';
	if(formObj.email.value.match(emailRegExp)){
		//
		formObj.action = "storeForgot.html";
		//formObj.doLogin.name="submit";
		formObj.submit();
	} else {
		alert("enter a properly formatted email address for \"Username\"");
	}
}

function loginvalidate(formObj){
	
	if(formObj.email.value.match(emailRegExp)){
		return true;
	} else {
		alert("enter a properly formatted email address");
		return false;
	}
}

var selectionObjs  = new Array();
var currentSelObj = -1;
var searchOptionsText = new Array();

function getSearchOptions(e, divId, searchTypeVal, searchVal){
	var unicode=e.keyCode? e.keyCode : e.charCode
	divObj = document.getElementById(divId);
	if(selectionObjs.length > 0){
		if(unicode == 40){
			if(currentSelObj == selectionObjs.length -1){
			
			} else {
				currentSelObj +=1;
			}
			setSelection(currentSelObj);
			return true;
		} else if (unicode == 38){
			if(currentSelObj <0 ){
				document.getElementById('searchTextInput').value = searchVal;
			} else {
				currentSelObj -=1;
			}
			setSelection(currentSelObj);
			return true;
		} 
	}
	getRemoteData("utils/searchDropDown.php?type="+searchTypeVal+"&val="+searchVal,divObj);
}

function hideSearchOptions(divId){
	document.getElementById(divId).innerHTML = "";
}

function setSearchSelObjs(itemObj){
	selectionObjs[selectionObjs.length] = itemObj;
}

function resetSearchSelObjArr(){
	selectionObjs  = new Array();
	currentSelObj = -1;
	searchOptionsText = new Array();
}

function setSelection(id){
	searchInputObj = document.getElementById('searchTextInput');
	for(var i=0; i < selectionObjs.length; i++){
		if(i == id){
			//selectionObjs[i].setAttribute("class", "searchResultLinkHover");
			selectionObjs[i].className="searchResultLinkHover";
			searchInputObj.value = searchOptionsText[i]; 
		} else {
			//selectionObjs[i].setAttribute("class", "searchResultLink"); 
			selectionObjs[i].className="searchResultLink";
		}
	}
}

function hideSearchOptions(){
	document.getElementById('searchSelectDiv').innerHTML = "";
}


function bookmark_us(url, title){

if (window.sidebar) // firefox
    window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
    var elem = document.createElement('a');
    elem.setAttribute('href',url);
    elem.setAttribute('title',title);
    elem.setAttribute('rel','sidebar');
    elem.click();
}
else if(document.all)// ie
    window.external.AddFavorite(url, title);
}

//-->
