﻿ //showmember();
 function closethis(id)
{
  var obj = document.getElementById(id);
  obj.style.display="none";
}
function checkc()
{
if(document.getElementById("cbmcountry").value=="0")

{
document.getElementById("dcountry").style.display="";
return false;
}
}
    function showmember(){
       
             
                //创建浏览器兼容的XMLHttpRequest对象
                var xmlhttp1;
                try{
                    xmlhttp1= new ActiveXObject('Msxml2.XMLHTTP');
                }catch(e){
                    try{
                        xmlhttp1= new ActiveXObject('Microsoft.XMLHTTP');
                    }catch(e){
                        try{
                            xmlhttp1= new XMLHttpRequest();
                        }catch(e){}
                    }
                }
                //定义XMLHttpRequest对象的事件处理程序
                xmlhttp1.onreadystatechange=function(){
                    if(xmlhttp1.readyState==4){
                        //关闭显示条
                       
                        if(xmlhttp1.status==200){
                            //当加载成功时将内容显示于页面
                            if(xmlhttp1.responseText==0)
                            {
                             //document.getElementById("member").innerHTML="1111";
                             document.getElementById("member").style.display="";
                             document.getElementById("member1").style.display="";
                           
                            }
                            else
                            {
                              document.getElementById("member").style.display="none";
                              document.getElementById("member1").style.display="none"; 
                              document.getElementById("txtcontent").value="";
                          
                            }
                        }else{
                            //否则弹出错误信息
                             
                        }
                    }
                }
                //创建一个连接
                xmlhttp1.open("get","/Hotproducts/ajaxmember.aspx");
                //发送请求
                xmlhttp1.send(null);

            }
            
              function showmembernew(){
       
             
                //创建浏览器兼容的XMLHttpRequest对象
                var xmlhttp1;
                try{
                    xmlhttp1= new ActiveXObject('Msxml2.XMLHTTP');
                }catch(e){
                    try{
                        xmlhttp1= new ActiveXObject('Microsoft.XMLHTTP');
                    }catch(e){
                        try{
                            xmlhttp1= new XMLHttpRequest();
                        }catch(e){}
                    }
                }
                //定义XMLHttpRequest对象的事件处理程序
                xmlhttp1.onreadystatechange=function(){
                    if(xmlhttp1.readyState==4){
                        //关闭显示条
                       
                        if(xmlhttp1.status==200){
                            //当加载成功时将内容显示于页面
                            if(xmlhttp1.responseText==0)
                            {
                             //document.getElementById("member").innerHTML="1111";
                             document.getElementById("member").style.display="";
                             document.getElementById("member1").style.display="";
                             document.getElementById("member2").style.display="";
                             document.getElementById("member3").style.display="";
                             document.getElementById("member4").style.display="";
                               document.getElementById("member5").style.display="";
                            }
                            else
                            {
                              document.getElementById("member").style.display="none";
                              document.getElementById("member1").style.display="none"; 
                               document.getElementById("member2").style.display="none";
                             document.getElementById("member3").style.display="none";
                             document.getElementById("member4").style.display="none";
                             document.getElementById("member5").style.display="none";
                              document.getElementById("txtcontent").value="";
                          
                            }
                        }else{
                            //否则弹出错误信息
                             
                        }
                    }
                }
                //创建一个连接
                xmlhttp1.open("get","/Hotproducts/ajaxmember.aspx");
                //发送请求
                xmlhttp1.send(null);

            }
            
                function Issupplier(cas){
       
                         
                //创建浏览器兼容的XMLHttpRequest对象
                var xmlhttp1;
                try{
                    xmlhttp1= new ActiveXObject('Msxml2.XMLHTTP');
                }catch(e){
                    try{
                        xmlhttp1= new ActiveXObject('Microsoft.XMLHTTP');
                    }catch(e){
                        try{
                            xmlhttp1= new XMLHttpRequest();
                        }catch(e){}
                    }
                }
                //定义XMLHttpRequest对象的事件处理程序
                xmlhttp1.onreadystatechange=function(){
                    if(xmlhttp1.readyState==4){
                        //关闭显示条
                       
                        if(xmlhttp1.status==200){
                                             // alert(xmlhttp1.responseText);
                            //当加载成功时将内容显示于页面
                            if(xmlhttp1.responseText!="0")
                            {
                            // return "0";
                             //document.getElementById("issupplier").innerHTML="11111111111";
                           
                            }
                            else
                            {     
                              
                                //  document.getElementById("issupplier").innerHTML="Temporarily, There is no supplier of this chemical. //Please submit your buy offers to our bid system to ask for Chemicals Customization Service.";
                                  //document.getElementById("formsend").action="/HotProducts/sendnosup.aspx";
                            } 
                           
                        }else{
                            //否则弹出错误信息
                             
                        }
                    }
                }
                //创建一个连接
                xmlhttp1.open("get","/Hotproducts/IsSupplier.aspx?cas="+cas);
                //发送请求
                xmlhttp1.send(null);

            }
            
            
            
                   function showsupplierp(cas,page){
       
             
                //创建浏览器兼容的XMLHttpRequest对象
                var xmlhttp1;
                try{
                    xmlhttp1= new ActiveXObject('Msxml2.XMLHTTP');
                }catch(e){
                    try{
                        xmlhttp1= new ActiveXObject('Microsoft.XMLHTTP');
                    }catch(e){
                        try{
                            xmlhttp1= new XMLHttpRequest();
                        }catch(e){}
                    }
                }
                //定义XMLHttpRequest对象的事件处理程序
                xmlhttp1.onreadystatechange=function(){
                    if(xmlhttp1.readyState==4){
                        //关闭显示条
                       
                        if(xmlhttp1.status==200){
                            //当加载成功时将内容显示于页面
                             document.getElementById("supplierhtml").innerHTML=xmlhttp1.responseText;

                        }else{
                            //否则弹出错误信息
                             
                        }
                    }
                }
                //创建一个连接
                xmlhttp1.open("get","/Hotproducts/ajaxsupplier.aspx?cas="+cas+"&p="+page);
                //发送请求
                xmlhttp1.send(null);

            }
            
            
               function showsupplier(cas){
       
             
                //创建浏览器兼容的XMLHttpRequest对象
                var xmlhttp1;
                try{
                    xmlhttp1= new ActiveXObject('Msxml2.XMLHTTP');
                }catch(e){
                    try{
                        xmlhttp1= new ActiveXObject('Microsoft.XMLHTTP');
                    }catch(e){
                        try{
                            xmlhttp1= new XMLHttpRequest();
                        }catch(e){}
                    }
                }
                //定义XMLHttpRequest对象的事件处理程序
                xmlhttp1.onreadystatechange=function(){
                    if(xmlhttp1.readyState==4){
                        //关闭显示条
                       
                        if(xmlhttp1.status==200){
                            //当加载成功时将内容显示于页面
                             document.getElementById("supplierhtml").innerHTML=xmlhttp1.responseText;

                        }else{
                            //否则弹出错误信息
                             
                        }
                    }
                }
                //创建一个连接
                xmlhttp1.open("get","/Hotproducts/ajaxsupplier.aspx?cas="+cas);
                //发送请求
                xmlhttp1.send(null);

            }
            function dosubmit()
            {
              
                 obj=document.getElementById("txtemail");
              var patn = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
              if(document.getElementById("member").style.display!="none")
              {
              if (!patn.test(obj.value)){
               alert("Please enter a valid email address.");
              document.getElementById("txtemail").focus();
                 return;
               }
               if(document.getElementById("cbmcountry").value==0)
               {
               alert("please check country");
               return;
               }
               
               }
                 if(document.getElementById("txtcontent").value.length<5)
               {
               alert("must more then 5 char");
               return;
               }

               document.getElementById("formsend").submit();
                 

            
            }
                       function dosubmitnew()
            {
              
                 obj=document.getElementById("txtemail");
              var patn = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
              if(document.getElementById("member").style.display!="none")
              {
              if (!patn.test(obj.value)){
               alert("Please enter a valid email address.");
              document.getElementById("txtemail").focus();
                 return;
               }
               if(document.getElementById("cbmcountry").value==0)
               {
               alert("please check country");
               document.getElementById("cbmcountry").focus();
               return;
               }
                if(document.getElementById("companyname").value=="")
               {
               alert("please enter company name");
                document.getElementById("companyname").focus();
               return;
               }
            
             if(document.getElementById("truename").value=="")
               {
               alert("please enter your name");
                document.getElementById("truename").focus();
               return;
               }
                }
                 if(document.getElementById("txtcontent").value.length<5)
               {
               alert("Description must more then 5 char");
                document.getElementById("txtcontent").focus();
               return;
               }

               document.getElementById("formsend").submit();
                 

            
           }
                 function isdel()
            {
            var ok=confirm("确定删除吗?");
            if(!ok)return false
            else return true
            
            }
            function GetCookie(name)
{
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
        if(arr=document.cookie.match(reg)) return unescape(arr[2]);
        else return null;
}

 function showsend(cas,product)
            {         
         //document.writeln("	Please post your buying leads,so that our qualified suppliers will soon contact you!");
   document.writeln("	   <a name=\"Inquire\"></a>");
document.writeln("                <form id=\"formsend\" action=\"/HotProducts/send.aspx\" method=\"post\">");
document.writeln("                <table width=\"500\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"margin:20px 0px 0px 0px; color:black;\">");
document.writeln("                ");
document.writeln("                        <tr>");
document.writeln("                          <td align=\"right\"><span class=\"location_font2\">CAS:&nbsp;</span></td>");
document.writeln("                          <td align=\"left\"><input name=\"txtcas\" type=\"text\" value=\""+cas+"\" maxlength=\"20\" id=\"txtcas\" /></td>");
document.writeln("                        </tr>");
document.writeln("                        <tr><td width=\"30%\" align=\"right\"><span class=\"location_font\">Purchase Request:</span></td>");
document.writeln("                            <td width=\"70%\" align=\"left\"><input name=\"txttitle\" type=\"text\" value=\"Name:"+product+"\" maxlength=\"255\" id=\"txttitle\"  style=\"width:300px;\" />                               </td></tr>");
document.writeln("                                ");
document.writeln("                      ");
document.writeln("	                        ");
document.writeln("                            <tr id=\"member\" style=\"display:none;\"><td align=\"right\"><span class=\"location_font\">Your email: </span></td><td align=\"left\">");
document.writeln("                            ");
document.writeln("                            ");
document.writeln("                        <input name=\"txtemail\" type=\"text\" maxlength=\"100\" id=\"txtemail\" tabindex=\"1\"  style=\"width:251px;\" />");
document.writeln("                     </td>");
document.writeln("                        </tr>");
document.writeln("                        ");
document.writeln("                        <tr id=\"member1\" style=\"display:none;\"><td align=\"right\"><span class=\"location_font\">Country/Region:</span></td>");
document.writeln("                                <td align=\"left\"><select name=\"cbmcountry\" id=\"cbmcountry\"  style=\"z-index: 1;\">");
document.writeln("		<option value=\"0\">Select your country</option>");
document.writeln("");
document.writeln("	</select><script src=\"/js/Country.js\"></script>                    </td></tr>");
document.writeln("                                        ");
document.writeln("                                    ");
document.writeln("                                    ");
document.writeln("                        ");
document.writeln("  ");
document.writeln("");
document.writeln("");
document.writeln("<tr><td align=\"right\" valign=\"top\"><span class=\"location_font\">Description:</span></td>");
document.writeln("");
document.writeln("");
document.writeln("<td align=\"left\"><textarea name=\"txtcontent\" rows=\"2\" cols=\"20\" id=\"txtcontent\"  style=\"height:100px;width:330px;\">Company:");
document.writeln("Contact:");
document.writeln("Tel:");
document.writeln("MSN:");
document.writeln("Requirements:");
document.writeln("                                </textarea>                                ");
document.writeln("                                <div class=\"lnquiry_Error1\" id=\"dcontent\" style=\"display: none;\">Please enter your message\'s description.</div></td></tr>");
document.writeln("                        <tr><td colspan=\"2\" align=\"center\" style=\"height: 45px\">");
document.writeln("                        ");
document.writeln("                     <img src=\"/images/Buyer.Seller/tijiao.gif\" onclick=\"dosubmit()\" title=\"Send RFQ for "+product+"\" style=\"border-width:0px; cursor:pointer; padding:5px 0px 5px 80px;\" /></td></tr>");
document.writeln("");
document.writeln("                       <tr><td colspan=\"2\" class=\"font_2\" style=\" padding:3px 0px 0px 28px;\">");
document.writeln("                               Please tick the suppliers below to send inquiries. Or complete and post your buying offer of CAS No "+cas+" above with your contact details. So that our qualified suppliers will send you quotations soonest. <br><br><span id=\"issupplier\"></span></td></tr></table> ");
document.writeln("                </form>");
 showmember();   
   Issupplier(cas);             
if(GetCookie('BuyEmail')!=''&&GetCookie('BuyEmail')!=null)
                {
                   document.getElementById("txtemail").value= GetCookie('BuyEmail');
                }
                if(GetCookie('buyCountry')!=''&&GetCookie('buyCountry')!=null)
                {
                    document.getElementById("cbmcountry").selectedIndex= GetCookie('buyCountry');
                }
            
            }
               
                 
            
  
              function showsendcas(cas,product)
            {         
     
   document.writeln("	   <a name=\"Inquire\"></a>");
document.writeln("                <form id=\"formsend\" action=\"/HotProducts/send.aspx?type=cas\" method=\"post\">");
document.writeln("                <table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"margin-bottom: 10px;\">");
document.writeln("                ");
document.writeln("                        <tr>");
document.writeln("                          <td align=\"right\"><span class=\"location_font2\">CAS:</span></td>");
document.writeln("                          <td align=\"left\"><input name=\"txtcas\" type=\"text\" value=\""+cas+"\" maxlength=\"20\" id=\"txtcas\" /></td>");
document.writeln("                        </tr>");
document.writeln("                        <tr><td width=\"173\" align=\"right\"><span class=\"location_font\">Purchase Request:</span></td>");
document.writeln("                            <td width=\"628\" align=\"left\"><input name=\"txttitle\" type=\"text\" value=\"Name:"+product+"\" maxlength=\"255\" id=\"txttitle\"  style=\"width:300px;\" />                               </td></tr>");
document.writeln("                                ");
document.writeln("                      ");
document.writeln("	                        ");
document.writeln("                            <tr id=\"member\" style=\"display:none;\"><td align=\"right\"><span class=\"location_font\">Your email: </span></td><td align=\"left\">");
document.writeln("                            ");
document.writeln("                            ");
document.writeln("                        <input name=\"txtemail\" type=\"text\" maxlength=\"100\" id=\"txtemail\" tabindex=\"1\"  style=\"width:251px;\" />");
document.writeln("                     </td>");
document.writeln("                        </tr>");
document.writeln("                        ");
document.writeln("                        <tr id=\"member1\" style=\"display:none;\"><td align=\"right\"><span class=\"location_font\">Country/Region:</span></td>");
document.writeln("                                <td align=\"left\"><select name=\"cbmcountry\" id=\"cbmcountry\"  style=\"z-index: 1;\">");
document.writeln("		<option value=\"0\">Select your country</option>");
document.writeln("");
document.writeln("	</select><script src=\"/js/Country.js\"></script>                    </td></tr>");
document.writeln("                                        ");
document.writeln("                                    ");
document.writeln("                                    ");
document.writeln("                        ");
document.writeln("  ");
document.writeln("");
document.writeln("");
document.writeln("<tr><td align=\"right\" valign=\"top\"><span class=\"location_font\">Description:</span></td>");
document.writeln("");
document.writeln("");
document.writeln("<td align=\"left\"><textarea name=\"txtcontent\" rows=\"2\" cols=\"20\" id=\"txtcontent\"  style=\"height:100px;width:450px;\">Company:");
document.writeln("Contact:");
document.writeln("Tel:");
document.writeln("MSN:");
document.writeln("Requirements:");
document.writeln("                                </textarea>                                ");
document.writeln("                                <div class=\"lnquiry_Error1\" id=\"dcontent\" style=\"display: none;\">Please enter your message\'s description.</div></td></tr>");
document.writeln("                        <tr><td colspan=\"2\" align=\"center\" style=\"height: 45px\">");
document.writeln("                        ");
document.writeln("                     <img src=\"/images/Buyer.Seller/Send.gif\" onclick=\"dosubmit()\" title=\"Send RFQ for "+product+"\" style=\"border-width:0px; cursor:pointer;\" />");
document.writeln("");
document.writeln("                        <br />");
document.writeln("                                <span class=\"font_2\" style=\"text-align:left;\">Please tick the suppliers below to send inquiries. Or complete and post your buying offer of CAS No "+cas+" above with <br />your contact details. So that our qualified suppliers will send you quotations soonest. </span><br><br><span id=\"issupplier\"></span></td></tr>");
document.writeln("<tr><td></td><td> </td></tr> </table>  ");

document.writeln("                </form>");
  showmember();

    Issupplier(cas);
                if(GetCookie('BuyEmail')!=''&&GetCookie('BuyEmail')!=null)
                {
                   document.getElementById("txtemail").value= GetCookie('BuyEmail');
                }
                if(GetCookie('buyCountry')!=''&&GetCookie('buyCountry')!=null)
                {
                    document.getElementById("cbmcountry").selectedIndex= GetCookie('buyCountry');
                }
      
            }
            
              function showsendcasnew(cas,product)
            {         
     
   document.writeln("	   <a name=\"Inquire\"></a>");
document.writeln("                <form id=\"formsend\" action=\"/HotProducts/send.aspx\" method=\"post\">");
document.writeln("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
document.writeln("                <tr>");
document.writeln("                  <td width=\"30%\" height=\"28\" align=\"right\"><strong>CAS：</strong></td>");
document.writeln("                  <td width=\"70%\" height=\"28\"><input id=\"txtcas\" name=\"txtcas\" type=\"text\" value=\""+cas+"\" style=\"width:50%;\" /></td>");
document.writeln("                </tr>");
document.writeln("                <tr>");
document.writeln("                  <td height=\"28\" align=\"right\"><strong>Purchase Request：</strong></td>");
document.writeln("                  <td height=\"28\"><input id=\"txttitle\" name=\"txttitle\" type=\"text\" value=\"Name:"+product+"\" style=\"width:320px;\"  /></td>");
document.writeln("                </tr>");
document.writeln("                <tr id=\"member\">");
document.writeln("                  <td height=\"28\" align=\"right\"><img src=\"/images/home/reg_1.gif\" width=\"5\" height=\"5\"  align=\"absmiddle\"/>&nbsp;<strong>Your email：</strong></td>");
document.writeln("                  <td height=\"28\"><input id=\"txtemail\" name=\"txtemail\" type=\"text\" style=\"width:60%;\" /></td>");
document.writeln("                </tr>");
document.writeln("                <tr id=\"member1\">");
document.writeln("                  <td height=\"28\" align=\"right\"><img src=\"/images/home/reg_1.gif\" width=\"5\" height=\"5\"  align=\"absmiddle\"/>&nbsp;<strong>Your Country/Region：</strong></td>");
document.writeln("                  <td height=\"28\"><select name=\"cbmcountry\" id=\"cbmcountry\"  style=\"z-index: 1;\">");
document.writeln("		<option value=\"0\">Select your country</option>");
document.writeln("	</select><script src=\"/js/Country.js\"></script>                </td>");
document.writeln("                </tr>");
document.writeln("                <tr id=\"member2\">");
document.writeln("                  <td height=\"28\" align=\"right\"><img src=\"/images/home/reg_1.gif\" width=\"5\" height=\"5\"  align=\"absmiddle\"/>&nbsp;<strong>Your company：</strong></td>");
document.writeln("                  <td height=\"28\"><input id=\"companyname\" name=\"companyname\" type=\"text\" style=\"width:75%;\" /></td>");
document.writeln("                </tr>");
document.writeln("                <tr id=\"member3\">");
document.writeln("                  <td height=\"28\" align=\"right\"><img src=\"/images/home/reg_1.gif\" width=\"5\" height=\"5\"  align=\"absmiddle\"/>&nbsp;<strong>Your name：</strong></td>");
document.writeln("                  <td height=\"28\"><input id=\"truename\" name=\"truename\" type=\"text\" style=\"width:75%;\" /></td>");
document.writeln("                </tr>");
document.writeln("                <tr id=\"member4\">");
document.writeln("                  <td height=\"28\" align=\"right\"><strong>Tel：</strong></td>");
document.writeln("                  <td height=\"28\"><input id=\"Tel\" name=\"tel\" type=\"text\" style=\"width:75%;\" /></td>");
document.writeln("                </tr>");
document.writeln("                <tr id=\"member5\">");
document.writeln("                  <td height=\"28\" align=\"right\"><strong>Msn：</strong></td>");
document.writeln("                  <td height=\"28\"><input id=\"Msn\" name=\"Msn\" type=\"text\" style=\"width:75%;\" /></td>");
document.writeln("                </tr>");
document.writeln("                <tr>");
document.writeln("                  <td height=\"28\" align=\"right\"><strong>Description：</strong></td>");
document.writeln("                  <td height=\"28\"><textarea id= \"txtcontent\" name=\"txtcontent\" rows=\"5\" style=\"width:90%;\">");

document.writeln("</textarea></td>");

document.writeln("                </tr>");
document.writeln("                <tr>");
document.writeln("                  <td height=\"45\" colspan=\"2\" align=\"center\" class=\"Notes\">  <img src=\"/images/Buyer.Seller/Send.gif\" onclick=\"dosubmitnew()\" title=\"Send RFQ for "+product+"\" style=\"border-width:0px; cursor:pointer;\" /></td>");
document.writeln("                </tr>");
document.writeln("                <tr>");
document.writeln("                  <td colspan=\"2\" align=\"center\" class=\"Notes\">Please tick the suppliers below to send inquiries. Or complete and post your buying offer of CAS No "+cas+" above with your contact details. So that our qualified suppliers will send you quotations soonest. </td>");
document.writeln("                </tr>");
document.writeln("              </table>");

document.writeln("                </form>");
  showmembernew();

    Issupplier(cas);
                if(GetCookie('BuyEmail')!=''&&GetCookie('BuyEmail')!=null)
                {
                   document.getElementById("txtemail").value= GetCookie('BuyEmail');
                }
                if(GetCookie('buyCountry')!=''&&GetCookie('buyCountry')!=null)
                {
                    document.getElementById("cbmcountry").selectedIndex= GetCookie('buyCountry');
                }
      
            }