function HighlightRowIfChecked(checkBox){
    var bgColor = checkBox.checked ? "#fdfcf0" : "";
    var el = checkBox.parentNode;
    while(el.tagName.toLowerCase() != "tr"){
        el = el.parentNode;
    }
    el.style.backgroundColor = bgColor;
}


function HighlightColIfChecked(checkBox){
    var bgColor = checkBox.checked ? "#81ed84" : "";
    var el = checkBox.parentNode;
    while(el.tagName.toLowerCase() != "td"){
        el = el.parentNode;
    }
    el.style.backgroundColor = bgColor;
}


/*==Check 2 checkbox only for Compare products==*/

/***********************************************
* Limit number of checked checkboxes script- by JavaScript Kit (www.javascriptkit.com)
* This notice must stay intact for usage
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more
***********************************************/

    
function checkboxlimit(checkgroup, limit){
	var checkgroup=checkgroup
	var limit=limit
	for (var i=0; i<checkgroup.length; i++){
		checkgroup[i].onclick=function(){
		var checkedcount=0
		for (var i=0; i<checkgroup.length; i++)
			checkedcount+=(checkgroup[i].checked)? 1 : 0
		if (checkedcount>limit){
			alert("You can only select a maximum of "+limit+" checkboxes")
			this.checked=false
			}
		}
	}
}
/*==Check 2 checkbox only for Compare products==*/





function hidediv() {
    if (document.getElementById) {
        // DOM3 = IE5, NS6
        document.getElementById('popuar').style.visibility = 'hidden';
        document.getElementById('more').style.visibility = 'visible';
    }
    else {
        if (document.layers) {
        // Netscape 4
            document.popuar.visibility = 'hidden';
            document.more.visibility = 'visible';

        }
        else {
            // IE 4
            document.all.popuar.style.visibility = 'hidden';
            document.all.more.style.visibility = 'visible';
        }
    }
}

function showdiv() {
    if (document.getElementById) {
        // DOM3 = IE5, NS6
        document.getElementById('popuar').style.visibility = 'visible';
        document.getElementById('more').style.visibility = 'hidden';
    }
    else {
        if (document.layers) {
            // Netscape 4
            document.popuar.visibility = 'visible';
            document.more.visibility = 'hidden';
        }
        else {
            // IE 4
            document.all.popuar.style.visibility = 'visible';
            document.all.more.style.visibility = 'hidden';
        }
    }
}



function confirm_remove_listing(){
    var agree=confirm("Are you sure do you want to remove?");
    if (agree)
	    return true ;
    else
	    return false ;
}


function confirm_remove_category(){
    var agree=confirm("Are you sure do you want to remove? If you are remove this category all products that relate with category are remove too.");
    if (agree)
	    return true ;
    else
	    return false ;
}


function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57 || charCode!=46))
            return false;

         return true;
}


function intonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) ||
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789.").indexOf(keychar) > -1))
   return true;


else
   return false;
}




