
function MaxMin(img)
{
    IncholOpenClose(img,'BasicInfoZone','220px','/app_themes/admin/images/system/expand.jpg','/app_themes/admin/images/system/extract.jpg','V');
}

function ShowDivById(div)
{
   var currdiv = document.getElementById(div);
   if(currdiv.style.display=="none")
      currdiv.style.display = "block";
   else
      currdiv.style.display = "none";
}

function ShowBigImage(link)
{
    strUrl = "ViewImage.aspx?path="+link;
  return window.open(strUrl, "_blank", "scrollbars=yes,status=no,resizable=yes,height=500,location=0,width=700,left=50,top=50");
}

function AddToCart(id, returnURL, quantityId)
{
    var quantity = 1;
    var objQuantity = document.getElementById(quantityId);
    if(objQuantity!=null)
    {
        quantity = objQuantity.value;
        if(!(/\d+/).test(quantity) || quantity <=0)
        {
            alert('Quantity must be greater than 0 the integer.' );
            objQuantity.select();
            return;
        }
    }
        
    var url = "/store/AddToCart.aspx?id="+id+"&q="+quantity+"&r="+returnURL;
    window.location = url;
    //var ajax = new IncholAJAX(url, "", "", "");
    //ajax.RemoteServer(ajax);
    //IncholAJAX.prototype.ProcessIncholOverride = ProcessIncholOverride;
}

function ProcessIncholOverride()
{
    var responseText = this.GetResponseText();
    if(responseText != "END")
    {
       //alert(responseText);
       alert("Item has been successfully added to your cart!");
       window.location.reload();
    }
    else
    {
        window.location.reload();
    }
}

function updateChildCategoryStatue(sender, childId, imagePlus, imageMinus)
{
    ShowDivById(childId);
    
    if(sender.src.toLowerCase().indexOf(imagePlus.toLowerCase()) >= 0)
    {
        sender.src = imageMinus;
    }
    else        
        sender.src = imagePlus;
}

function checkCharIsLegitimate(sender, senderId, resultId, errMsg)
{
    var str = sender.value;
    var objResult = document.getElementById(sender.id.replace(senderId, resultId));
    objResult.innerHTML = "";
    for(var i=0; i<str.length; i++)
    {
        var chr = str[i];
        var c = chr.charCodeAt(0);
        //alert(chr + "  "  + c)
        if (c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122 || c == 32 || c==38 || c == 39 || c == 45)
        {
            //
        }
        else
        {
            objResult.innerHTML = errMsg;
            return false;
        }
    }
    
    return true;
}

function VerifyCodeClientFunction(textValue, cookieName) 
{
    cookieName = cookieName + "_VerifyCode";
    var verifyCode = GetCookie(cookieName);
    if(verifyCode != "" && textValue != "" && verifyCode.toLowerCase() == textValue.toLowerCase())
        {return true;}
    else 
        {return false;}
}

function stopBubble(e)
{
     if(window.event){
        window.event.CancelBubble=true; window.event.returnValue = false;
    }
    else if(e.stopPropagation){
e.stopPropagation(); e.preventDefault();}
}


function menu_mouseover(sender)
{
    sender.className = sender.className + " title_hover";
}
function menu_mouseout(sender)
{
    sender.className = sender.className.replace(" title_hover", "");
}


function bookMark(){
    var title = "GLCMall";
    var location = window.location;
    var url = location.href.replace(location.search, "");
    var len = arguments.length;
    if(len > 0 && arguments[0].length >0)
    {
        url = arguments[0];
    }
    if(len > 1 && arguments[1].length >0)
    {
        title = arguments[1];
    }
            
    if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')){
    //if (window.sidebar) {   
        window.sidebar.addPanel(title, location,"");   
    }
    else if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)){
        window.external.AddFavorite(url,title);
    }
    else showalert();
};
