function bookmark(url, description) {
  netscape="Netscape User's hit CTRL+D to add a bookmark to this site."
  if (navigator.appName=='Microsoft Internet Explorer'){
    window.external.AddFavorite(url, description);
  }
  else if (navigator.appName=='Netscape'){
    alert(netscape);
  }
}

function newImage(arg) {
        if (document.images) {
                rslt = new Image();
                rslt.src = arg;
                return rslt;
        }
}

function changeImages() {
        if (document.images && (preloadFlag == true)) {
                for (var i=0; i<changeImages.arguments.length; i+=2) {
                        document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
                }
        }
}

function preloadImages() {
        if (document.images) {
                home_over = newImage("/images/home_over.gif");
                new_coupons_over = newImage("/images/new_coupons_over.gif");
                all_stores_over = newImage("/images/all_stores_over.gif");
                expiring_soon_over = newImage("/images/expiring_soon_over.gif");
                most_popular_over = newImage("/images/most_popular_over.gif");
                free_shipping_over = newImage("/images/free_shipping_over.gif");
                need_help_over = newImage("/images/need_help_over.gif");
                search_over = newImage("/images/search_over.gif");
                preloadFlag = true;
        }
}

function MoveOption(objSourceElement, objTargetElement){

        var aryTempSourceOptions = new Array();
        var x = 0;
        
        //looping through source element to find selected options
        for (var i = 0; i < objSourceElement.length; i++) {
            if (objSourceElement.options[i].selected) {
                //need to move this option to target element
                var intTargetLen = objTargetElement.length++;
                objTargetElement.options[intTargetLen].text = objSourceElement.options[i].text;
                objTargetElement.options[intTargetLen].value = objSourceElement.options[i].value;
            }
            else {
                //storing options that stay to recreate select element
                var objTempValues = new Object();
                objTempValues.text = objSourceElement.options[i].text;
                objTempValues.value = objSourceElement.options[i].value;
                aryTempSourceOptions[x] = objTempValues;
                x++;
            }
        }
        
        //resetting length of source
        objSourceElement.length = aryTempSourceOptions.length;
        //looping through temp array to recreate source select element
        for (var i = 0; i < aryTempSourceOptions.length; i++) {
            objSourceElement.options[i].text = aryTempSourceOptions[i].text;
            objSourceElement.options[i].value = aryTempSourceOptions[i].value;
            objSourceElement.options[i].selected = false;
        }
}


function MoveStoreOption(objSourceElement, objTargetElement){

        var aryTempSourceOptions = new Array();
        var x = 0;

        //looping through source element to find selected options
        for (var i = 0; i < objSourceElement.length; i++) {
            if (objSourceElement.options[i].selected) {
                //need to move this option to target element
                var intTargetLen = objTargetElement.length++;
                objTargetElement.options["stores[]"][intTargetLen].text = objSourceElement.options["stores[]"][i].text;
                objTargetElement.options["stores[]"][intTargetLen].value = objSourceElement.options[i].value;
            }
            else {
                //storing options that stay to recreate select element
                var objTempValues = new Object();
                objTempValues.text = objSourceElement.options["stores[]"][i].text;
                objTempValues.value = objSourceElement.options["stores[]"][i].value;
                aryTempSourceOptions[x] = objTempValues;
                x++;
            }
        }

        //resetting length of source
        objSourceElement.length = aryTempSourceOptions.length;
        //looping through temp array to recreate source select element
        for (var i = 0; i < aryTempSourceOptions.length; i++) {
            objSourceElement.options["stores[]"][i].text = aryTempSourceOptions[i].text;
            objSourceElement.options["stores[]"][i].value = aryTempSourceOptions[i].value;
            objSourceElement.options["stores[]"][i].selected = false;
        }
}



function checkAllCategories() {
	for (var i = 0; i < document.setup["categories[]"].length; i++) {
		document.setup["categories[]"][i].checked = true;
	}
}

function uncheckAllCategories() {
        for (var i = 0; i < document.setup["categories[]"].length; i++) {
                document.setup["categories[]"][i].checked = false;
        }
}


function checkAll(field){
  for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll(field){ 
  for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}

function getSelectValues(objSourceElement,form){
        var selectValues = "";
        for (var i = 0; i < objSourceElement.length; i++) {
		selectValues += objSourceElement.options[i].value + ",";
        }
  	form.stores.value=selectValues;
}

function popUp(URL) {
  day = new Date();
  id = day.getTime();
  eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=300,height=230');");
}

function popUpFullscreen(URL) {
 day = new Date();
 id = day.getTime();
 eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=1024,height=768');");
}

function showProductDetails(tbodyid,dis) {
  document.getElementById(tbodyid).style.display = dis;
}

