﻿// JScript File
    function extendMenu(val, valtotal,gHeight)
    {
        disableallpnl(valtotal);
        document.getElementById('ctl00_tc'+val).style.backgroundColor = '#F1CEFA';
        document.getElementById('ctl00_pnl'+val).style.visibility = 'visible';
        document.getElementById('ctl00_pnl'+val).style.height = gHeight;
        document.getElementById('sp'+val).className = 'ClassClickedFont';
    }
    
    function disableallpnl(tval) {
        var i;
        for (i=0;i<tval ;i++) {
            document.getElementById('ctl00_tc'+i).style.backgroundColor= 'white';
            document.getElementById('ctl00_pnl' + i).style.visibility = 'hidden';
            document.getElementById('ctl00_pnl' + i).style.height = '0px';
            document.getElementById('sp'+i).className = 'ClassFont';
        }  
    }
    
    function mouseOverLink(val, valClass)
    {
       document.getElementById(val).className = valClass;
    }
    
    function mouseOutLink(val, valClass)
    {
        if(document.getElementById(val).className != 'ClassClickedFont')
        {
            document.getElementById(val).className = valClass;
        }
    }   
    
    function readCookie(name)
    {
        var nameEQ = name + "=";
	    var ca = document.cookie.split(';');
	    for(var i=0;i < ca.length;i++) 
	    {
		    var c = ca[i];
		    while (c.charAt(0)==' ') c = c.substring(1,c.length);
		    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	    }
	    return null;  
    }
    
    function createCookie(name, txt)
    {
        var date = new Date();
        date.setTime(date.getTime() + (1*24*60*60*1000));
        var expire = ';expires='+date.toGMTString();
        document.cookie = name+'='+txt+expire+'; path=/'; 
    }

    function eraseCookie(name) 
    {
	    createCookie(name,"",-1);
    }
    
    function LoadController(valfrm, val)
    {
        if(window.parent.document.getElementById(valfrm))
        {
            window.parent.document.getElementById(valfrm).src = 'adminControlHost.aspx?cid='+val;
        }
        else
        {
            alert('no object');
        }
    }

    
    function LoadCategory(val, pval)
    {
        if(document.getElementById('frm'+val))
        {
            document.location.href = 'Catalog.aspx?pageno='+pval;
        }
    }
    
    function ShowAllCategory(frmval)
    {
        if(document.getElementById('frm'+frmval))
        {
            document.location.href = 'Catalog.aspx?ShowAll=true';
        }
    }
    
    function reSize(gotVal) 
    {
        try
        {  
            var objBody = document.getElementById('frm'+gotVal).contentWindow.document.body;
            var frmHeight = objBody.scrollHeight+(objBody.offsetHeight - objBody.clientHeight);
            var objFrame = document.getElementById('frm'+gotVal);

            if(frmHeight <= 650)
            {
                objFrame.style.height = 700+'px';
            }
            else
            {
                objFrame.style.height = frmHeight+50+'px';
            }
        }
        catch(e){alert('Error :'+e.Message);}
    }

    function viewInventory(gStyle, IsAdmin)
    {
        if(IsAdmin)
        {
            window.parent.document.location.href = 'Inventory.aspx?itemno='+gStyle;
        }
        else
        {
            alert('Style:' +gStyle+', admin:'+IsAdmin);
        }
    }
    
    function CategoryNavigation(valClass, valCategory, nameCategory)
    {
        document.location.href = 'Catalog.aspx?class=' + valClass + '&category=' + valCategory;
//        document.getElementById('frmItemCategory').src = 'adminControlHost.aspx?class=' + valClass + '&category=' + valCategory;
//        document.getElementById('ctl00_ContentPlaceHolder1_txtCategoryName').value = nameCategory;
    }
    function goBack()
    {
        history.back();
    }