﻿
    //Changes the image for the CategoryView control on mouseover event.
    function loadCategoryImage(index, imageurl)
    {
        var sID = "ctl00_ctl00_ctl00_cphParentMainContent_MainContent_cphPublicHomeMainContent_ucProducts" + index + "_imgViewAllImg";
        var sDivID = "ctl00_ctl00_ctl00_cphParentMainContent_MainContent_cphPublicHomeMainContent_ucProducts" + index + "_divTest";
        var oImage = document.getElementById(sID);
        if (oImage != null)
        {
            Element.hide(sDivID);
            oImage.src = imageurl;
            new Effect.Appear(sDivID);            
        }
    }
    function loadimage(index, flag)
    {
        var imagename;
        if (flag == 'y')
            imagename = "ew_roll_" + index + ".gif";
        else
            imagename = "ew_" + index + ".gif";
        document.getElementById("img_" + index).src = "images/" + imagename;
    }
    function loadimageadmin(index, flag)
    {
        var imagename;
        if (flag == 'y')
            imagename = "ew_roll_" + index + ".gif";
        else
            imagename = "ew_" + index + ".gif";
        document.getElementById("img_" + index).src = "../images/" + imagename;
    }
    function loadimageleftnav(index, flag)
    {
        var imagename;
        if (flag == 'y')
            imagename = "ew_roll_" + index + ".gif";
        else
            imagename = "ew_" + index + ".gif";
        document.getElementById("ctl00_ContentLeftNav_img_" + index).src = "images/" + imagename;
    }

    function preloadImages() 
    { 
        if (document.images)
        { 
//            var a = new Array();
//            a[0] = 'images/ew_roll_link_view_all.gif';

//            var i;
//            for(i=0; i < a.length; i++)
//            {
//                var pic = new Image();
//                pic.src = a[i];
//            }
        }
    }

    function preloadAdminImages() 
    { 
        if (document.images)
        { 
//            var a = new Array();
//            a[0] = '../images/ew_roll_admin_volunteer.gif';

//            var i;
//            for(i=0; i < a.length; i++)
//            {
//                var pic = new Image();
//                pic.src = a[i];
//            }
        }
    }

    function gohome()
    {
        window.location = "Default.aspx";
    }
    
	function highlightDIV(field, divclassname)
	{
		//field.style.cursor = "hand";
        document.getElementById(field).className = divclassname;
	}
	function unhighlightDIV(field, divclassname)
	{
		//field.style.cursor = "auto";
        document.getElementById(field).className = divclassname;
	}
    
    function showDIV(field)
    {
        document.getElementById(field).style.position = "static";
        document.getElementById(field).style.visibility = "visible";
        document.getElementById("show" + field).style.visibility = "hidden";
        document.getElementById("show" + field).style.position = "absolute";
    }
    function hideDIV(field)
    {
        document.getElementById(field).style.position = "absolute";
        document.getElementById(field).style.visibility = "hidden";
        document.getElementById("show" + field).style.visibility = "visible";
        document.getElementById("show" + field).style.position = "static";
    }
    
    function previewImprint(templateID, title)
    {
        if (document.getElementById("ctl00_ctl00_cphParentMainContent_MainContent_hidImprintFields") != null);
        {
            var imprintfields = document.getElementById("ctl00_ctl00_cphParentMainContent_MainContent_hidImprintFields").value;
            var fields = "";
            var values = "";
            var temp = "";
            var arrfields = imprintfields.split("^");
            for (i=0; i < arrfields.length; i++)
            {
                temp = arrfields[i].substring(10);
                if (document.getElementById("ctl00_ctl00_cphParentMainContent_MainContent_txtImprint" + temp) != null)
                {
                    if (fields == "")
                    {
                        fields = temp;
                        values = document.getElementById("ctl00_ctl00_cphParentMainContent_MainContent_txtImprint" + temp).value;
                    }
                    else
                    {
                        fields = fields + "^" + temp;
                        values = values + "^" + document.getElementById("ctl00_ctl00_cphParentMainContent_MainContent_txtImprint" + temp).value;
                    }
                }
            }
            values = values.replace("&","and");
            window.open("PreviewImprint.aspx?ID=" + templateID + "&title=" + title + "&Data=" + fields + "|" + values, "previewWindow", "menubar=0,resizable=0,width=700,height=500");
        }
    }