﻿/* product details control scripts
validation for varients march 23 2007 */
    function isValidDate(oSrc,args)
    {
        var varientCombo = document.getElementById("ctl00_CPMiddle_productDetail1_ClientDropDownList1");
        var VCIndex = varientCombo.selectedIndex;
        if(this.varientCombo.style.visibility != "hidden")
        {
            if(VCIndex == "0")
            {
                args.IsValid =false;
            }
            else
            {
                args.IsValid = true;
            }
        }
        else 
        {
        
         var varientcolor = document.getElementById("ctl00_CPMiddle_productDetail1_Colors");
         var varientsize =document.getElementById("ctl00_CPMiddle_productDetail1_Size");
            
            if(varientcolor!=null && varientsize !=null )
            {
                var VCIndex = varientcolor.selectedIndex;
                var VZIndex =varientsize.selectedIndex;
                if(VCIndex != "0" && VZIndex != "0" )
                {
                    args.IsValid = true;
                }
                else
                {
                    args.IsValid =false;
                }
            
            }
        }
    }
    function callAddtoCart()
    {
        var error="";
        var varientCombo = document.getElementById("ctl00_CPMiddle_productDetail1_ClientDropDownList1");        
        if(varientCombo != null)
        {
            var VCIndex = varientCombo.selectedIndex;            
            if(varientCombo.style.visibility != "hidden")
            {
               if(VCIndex == "0")
                 error = "Please select a Variant";                
            }
        }
        else
        {
            var varientcolor = document.getElementById("ctl00_CPMiddle_productDetail1_Colors");
            var varientsize = document.getElementById("ctl00_CPMiddle_productDetail1_Size");           
            var variantMetal = document.getElementById("ctl00_CPMiddle_productDetail1_Metal");
            var variantFabric = document.getElementById("ctl00_CPMiddle_productDetail1_Fabric");
            var variantStyle = document.getElementById("ctl00_CPMiddle_productDetail1_Style");
            var variantGrip = document.getElementById("ctl00_CPMiddle_productDetail1_Grip");
            var variantStand = document.getElementById("ctl00_CPMiddle_productDetail1_Stand");
            var variantThickness = document.getElementById("ctl00_CPMiddle_productDetail1_Thickness");
            var variantFinish = document.getElementById("ctl00_CPMiddle_productDetail1_Finish");
            var variantUnits = document.getElementById("ctl00_CPMiddle_productDetail1_Units");
            var variantGauge = document.getElementById("ctl00_CPMiddle_productDetail1_Gauge");
            var variantAccessories = document.getElementById("ctl00_CPMiddle_productDetail1_Accessories");
            var variantCounty = document.getElementById("ctl00_CPMiddle_productDetail1_County");
                        
            if(varientcolor !=null)
            {
                if(varientcolor.selectedIndex==0)
                {
                    error="Please select a Color.\n";
                }
            }
            
            if(varientsize != null)
            {
                if(varientsize.selectedIndex==0)
                {
                    error="Please select a Size.\n";
                }   
            }
            
            if(variantMetal != null)
            {
                if(variantMetal.selectedIndex==0)
                {
                        error="Please select a Metal.\n";
                }                 
            }
            
            if(variantFabric != null)
            {
                if(variantFabric.selectedIndex==0)
                {
                        error="Please select a Fabric.\n";
                }                 
            }    
            
            if(variantStyle != null)
            {
                if(variantStyle.selectedIndex==0)
                {
                    error="Please select a Style.\n";
                }                 
            } 
            
            if(variantGrip != null)
            {
                if(variantGrip.selectedIndex==0)
                {
                   error="Please select a Grip.\n";
                }                 
            } 
            
            if(variantStand != null)
            {
                if(variantStand.selectedIndex==0)
                {
                   error="Please select a Stand.\n";
                }                 
            } 
            
            if(variantThickness != null)
            {
                if(variantThickness.selectedIndex==0)
                {
                   error="Please select a Thickness.\n";
                }                 
            } 
            
            if(variantFinish != null)
            {
                if(variantFinish.selectedIndex==0)
                {
                   error="Please select a Finish.\n";
                }                 
            }
            
            if(variantUnits != null)
            {
                if(variantUnits.selectedIndex==0)
                {
                   error="Please select a Units.\n";
                }                 
            } 
            
            if(variantGauge != null)
            {
                if(variantGauge.selectedIndex==0)
                {
                   error="Please select a Gauge.\n";
                }                 
            } 
            
            if(variantAccessories != null)
            {
                if(variantAccessories.selectedIndex==0)
                {
                   error="Please select a Accessories.\n";
                }                 
            } 
                        
            if(variantCounty != null)
            {
                if(variantCounty.selectedIndex==0)
                {
                   error="Please select a County.\n";
                }                 
            } 
        }
        if(error !="")
        {
          alert(error);
        }
        else
        { 
            var vco = document.getElementById("ctl00_CPMiddle_productDetail1_AddToCartLinkValue");
            var valueHref=vco.value;                   
            location.href=valueHref;
        }
    }
  function ShowpopupWindow(x)
  {
    x = x.toLowerCase();
    if ( x.indexOf("displayorder.aspx") >= 0 )
    {
       popWindow = window.open(x,"a","location=0,status=0,scrollbars=1,width=850,height=600");
    }
    else if(x.indexOf("usergiftcertificate.aspx") >= 0)
    {
        popWindow = window.open(x,"a","location=0,status=0,scrollbars=1,width=500,height=250");
        popWindow.moveTo(150,150);
    }
    else
    {
       popWindow = window.open(x,"a","location=0,status=0,scrollbars=1,width=500,height=150");
       popWindow.moveTo(150,150);
    }
  }
  function ShowLargeImg(x)
  {       
       if(x == 'MAM')
       {
           x = document.getElementById("CampaignDL_ctl00_HiddenField4").value;
       }
       x = x.toLowerCase();
       popWindow = window.open(x,"a","location=0,status=0,scrollbars=1,width=400,height=400");
  }
 function DeliverLocDisplay()
 {
    var Contol = document.getElementById("ctl00_CPMiddle_productDetail1_DeliverylocValue");
    var message=Contol.value;
    OpenWindow=window.open ('titlepage.html', 'newwindow','height=150,width=400, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, directories=no, status=no');
    OpenWindow.document.write("<html><TITLE>Indiaplaza.in</TITLE>");
    OpenWindow.document.write("<BODY>");
    OpenWindow.document.write("<div style=\"font-family:Verdana;font-size: 13px;color:Black;text-decoration:none;font-weight:bold;\">Cities</div><br/>");
    OpenWindow.document.write("<div style=\"font-family:Verdana;font-size: 11px;color:Black;text-decoration:none;\">")
    OpenWindow.document.write(message);
    OpenWindow.document.write("</div> ");
    OpenWindow.document.write("<br/><br/><center><a style=\"font-family:Verdana;font-size: 11px;color:Black;text-decoration:none;\" href='#' onclick='window.close()'>Close this window</a></center>");
    OpenWindow.document.write("</BODY>");
    OpenWindow.document.write("</html>");
 }
 
 function ViewDemoPost()
 {
    document.aspnetForm.action=  "http://www.indiaplaza.in/others/viewdemo.aspx";
    document.aspnetForm.submit();
 }