﻿function togglediv(id) {
    //safe function to hide an element with a specified id
    if (document.getElementById) { // DOM3 = IE5, NS6

        if (document.getElementById(id).style.display == 'none') showdiv(id);
        else hidediv(id);
    }
    else {
        if (document.layers) { // Netscape 4
            if (document.id.display == 'none') showdiv(id);
            else hidediv(id);
        }
        else { // IE 4
            if (document.all.id.style.display == 'none') showdiv(id);
            else hidediv(id);
        }
    }
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}


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 doconfirm()
{
    return confirm("Do you really want delete this item?");
}
function doconfirm_Attribute()
{
    return confirm("Do you really want delete this attribute, its values, and any product settings?");
}
function doconfirm_Attribute_Value()
{
    return confirm("Do you really want delete this attribute value?");
}

function CheckOverwrite()
{
    return confirm("By saving this image type, you may overwrite an existing image of the same image type.  For example, each product can only have one 'Primary' image.  If you upload a new image of type 'Primary', the new image will overwrite the existing 'Primary' image.  Are you sure you want to save this image?");
}
function CheckOverwriteGroups()
{
    return confirm("By saving this image type, you may overwrite an existing image of the same image type.  For example, each product group can only have one 'Primary' image.  If you upload a new image of type 'Primary', the new image will overwrite the existing 'Primary' image.  Are you sure you want to save this image?");
}






function SetActiveTabIndexCookie(cvalue) {
    if(document.cookie != document.cookie) 
    {
        index = document.cookie.indexOf(cookie_name);
    }
    else 
    { 
        index = -1;
    }

    if (index == -1)
    {
        document.cookie = 'activetabindex=' + cvalue + ";";
    }
}
