function rowHighlight(rID) {
	if (!gE(rID)) return;
	gE(rID).className += " rowH";
}
function rowUnHighlight(rID) {
	if (!gE(rID)) return;
	gE(rID).className = gE(rID).className.replace(" rowH", "");
}

function gE(eID) {
	return document.getElementById(eID);
}

function toggleHidden(hiddenID) {
	if (!document.getElementById) return;
	el = document.getElementById(hiddenID);
	if (el)
		el.style.display = (el.style.display=='none') ?  'block' : 'none';
}

function vardump(obj) {
            var t = '';
			s=1;
            for (i in obj) {
//				if (obj[i]) {
					t += i + ": " + obj[i] + " - - - - - - - - - ";
					if (s==5) {
						t += "\n";
						s=1;
					}
					s ++;
///				}
			}
//            for (i in obj) t += i + ": " + obj[i] + "<br>"
//			document.write(t);
            alert(t);
}

function addRecordToList(question, fldName, newFldName) {
	var cName = prompt(question, '');
	if (cName) {
		cNameSm = cName.toLowerCase();
		pEl = gE(fldName);
		selectT=0;
		for (i=0; i<pEl.options.length; i++) {
			el = pEl.options[i];
			if (el.text.toLowerCase()==cNameSm) {
				selectT = el.value;
				i = pEl.options.length++;
			}
		}
		if (selectT===0) {
			nEl = document.createElement("option");
			switch (fldName) {
			case "city":
			case "region":
				nEl.value=cName;
				selectT = cName;
				break;
			default:
				nEl.value=9999999;
				selectT = 9999999;
			}
			nEl.text=cName;
			pEl.add(nEl);
			gE(newFldName).value=cName;
		}
		pEl.value=selectT;
	}
}

var arImages=new Array();
function Preload() {
	var temp = Preload.arguments; 
	for(x=0; x < temp.length; x++) {
		arImages[x]=new Image();
		arImages[x].src=Preload.arguments[x];
	}
}

function clearPeriod(stField, endField, theForm) {
	clearCalendarField(stField, theForm);
	clearCalendarField(endField, theForm);
}

function clearCalendarField(field, theForm) {
	if (theForm[field])
		theForm[field].value='';
	if (gE('view' + field))
		gE('view' + field).innerHTML='';
}

// tabs management functions
var curTab=0;
function jumpToTab(tabID) {
	if (curTab) {
		setTabImgs('off', curTab);
		switchInfoTable('none', curTab);
	}
	setTabImgs('on', tabID);
	switchInfoTable('block', tabID);
	curTab = tabID;
	if (setValueOfJumpToTab)
		setValueOfJumpToTab();
}
function setTabImgs(way, tabID) {
	tabsPath = '/adm_pnl/images/tabs/';
	if (gE('leftTab' + tabID))
		gE('leftTab' + tabID).src=tabsPath + way + '_left.gif';
	if (gE('rightTab' + tabID))
		gE('rightTab' + tabID).src=tabsPath + way + '_right.gif';
	if (gE('tab' + tabID))
		gE('tab' + tabID).style.backgroundImage='url(' + tabsPath + way + '_back.gif)';
}
function switchInfoTable(setVl, tableID) {
	if (gE('tabTable' + tableID))
		gE('tabTable' + tableID).style.display=setVl;
}
// end of tabs management functions

/* dropdowns on shopBy top bar */
dropLPshown=0;
function displayDropDown(dropLPid) {
	if (gE('lp' + dropLPid + 'drop')) {
		gE('lp' + dropLPid + 'drop').style.display='block';
		dropLPshown=dropLPid;
	}
}
function hideDropDown(dropLPid) {
	if (gE('lp' + dropLPshown + 'drop')) {
		gE('lp' + dropLPshown + 'drop').style.display='none';
		dropLPshown=0;
	}
}

// this is being used on MouseOver at Features menu
function toggleFeaturesStar(starNum, imgPath, imgSuffix) {
	if (gE('featuresStar' + starNum))
		gE('featuresStar' + starNum).src=imgPath + 'star' + imgSuffix + '.gif';
}

function bookmarksite(title, url){
	if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
	else if (document.all)
		window.external.AddFavorite(url, title);
}

function switchAreaVsPhoneRequiry(el) {
	if (el) {
		theForm = el.form;
		if (theForm) {
			setVl = (el.value) ? 'NO' : 'YES'; //if there is a value - set to OPTIONAL='NO', otherwise - OPTIONAL='YES'
			elNameLen = el.name.length;
			setFld = (el.name.substring(elNameLen-4)=='area') ? el.name.substring(0, elNameLen-4) : el.name + 'area';
			if (theForm[setFld]) {
				theForm[setFld].setAttribute('OPTIONAL', setVl);
				if (!el.value)
					theForm[setFld].value='';
			}
	}	}
}

var XmlHttp;
var curRequest="";
var responseTexts = new Array();
function createXMLHttp(txtURL) {
	var aVersions = [ "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp","Microsoft.XMLHttp"];
    for (var i = 0; i < aVersions.length; i++) {
		try {
			if (navigator.appName!="Netscape") {
				var oXmlHttp = new ActiveXObject(aVersions[i]);
		    } else {
				var oXmlHttp = new XMLHttpRequest(); 
	    	}
			return oXmlHttp;
        } catch (oError) {
            //Do nothing
        }
    }
//	window.frames['ajaxLegacySupport'].location.href=txtURL;
//	id = window.setTimeout("afterBirksLegacy()",1000);
}

function send(txtURL, runFunction) {
	XmlHttp = createXMLHttp(txtURL);
	if (runFunction) {
		XmlHttp.onreadystatechange = eval(runFunction);
		XmlHttp.open("GET", txtURL);
	}
	XmlHttp.send(null);
}

function nothingDone(){
}
function validateRadioButton(theFld) {
	found = false;
	for (i=0; i<theFld.length && !found; i++)
		if (theFld[i].checked)
			found=true;
	if (found)
		res = i;
	else
		res = -1;
	return res;
}