// JavaScript Document
function createXMLHTTP() 
{
  var request;
  var browser = navigator.appName;
  //ʹIEʹXMLHttp
  if(browser == "Microsoft Internet Explorer") 
  {
    var arrVersions = ["Microsoft.XMLHttp", "MSXML2.XMLHttp.4.0",
      "MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp","MSXML2.XMLHttp.5.0"];
    for (var i=0; i < arrVersions.length; i++) 
    {
      try 
      {
	//ҵһֵ֧İ汾XMLHttp
        request = new ActiveXObject(arrVersions[i]); 
        return request;
      } 
      catch(exception)
      {
        //ԣ
      }
    }
  }
  else
  {
    //򷵻һXMLHttpRequest
    request = new XMLHttpRequest(); 
    return request;
  }   
}
//ȫXMLHttpRequestʵ
var http = createXMLHTTP(); 
//
function HelloWorld(urls)
{

  
	  var url = urls;
	  //ָ˵ĵַ
	  http.open("GET", url, true); 
	  //ص
	  http.onreadystatechange = getHello; 
	  //
	  http.send(null); 

  
}
//صӦ״̬仯¼
function getHello()       
{ 
  //4ʾ
  if (http.readyState == 4) 
  {
    //ȡεӦı
    var helloStr = http.responseText; 
	 document.getElementById('abc').innerHTML="";      
	
    //ӦIDΪ"ajax-ServerBack"DIVǩ
 showToolTip2(helloStr);
 if (helloStr=="You\'ve already made an Ondormi like that.")
 {
	 window.close();
 }
	
	
  }
}

//
function buyHelloWorld(urls)
{

  
	  var url = urls;
	  //ָ˵ĵַ
	  http.open("GET", url, true); 
	  //ص
	  http.onreadystatechange = buygetHello; 
	  //
	  http.send(null); 

  
}
//صӦ״̬仯¼
function buygetHello()       
{ 
  //4ʾ
  if (http.readyState == 4) 
  {
    //ȡεӦı
    var helloStr = http.responseText; 
	       
	
    //ӦIDΪ"ajax-ServerBack"DIVǩ
// showToolTip2(helloStr);
document.getElementById('abc').innerHTML="";
document.equipform.submit();	 

	
  }
}
function buyhrefa(strh){
dd=document.equipform;
//alert(dd.pro_id.value);
if (document.getElementById('list_name').value!="" && document.getElementById('list_name').value!="Name??"){
var urls='v2_buy.asp?l_name='+escape(document.getElementById('list_name').value);
buyHelloWorld(urls);
//v1_buy_if.location.href='v1_buy.asp?pro_id='+dd.pro_id.value+'&l_name='+document.getElementById('list_name').value+'&id='+dd.order_id.value+'&class_href='+strh;
//window.open('v1_buy.asp?pro_id='+dd.pro_id.value+'&l_name='+document.getElementById('list_name').value+'&id='+dd.order_id.value+'','_blank','top=5,toolbar=0,location=0,directories=0,menubar=0,scrollbars=0,resizable=0,status=0,copyhistory=0,fullscreen=0');
 //pop.resizeTo(0,0);
doOk();
}else{
	document.getElementById('list_name').value="Name??"
	}
	
	}
	
function hrefa(strh){
dd=document.equipform;
//alert(dd.pro_id.value);
if (document.getElementById('list_name').value!="" && document.getElementById('list_name').value!="Name??"){
var urls='v1_buy.asp?pro_id='+escape(dd.pro_id.value)+'&l_name='+escape(document.getElementById('list_name').value)+'&id='+escape(dd.order_id.value)+'&class_href='+escape(strh);
HelloWorld(urls);
//v1_buy_if.location.href='v1_buy.asp?pro_id='+dd.pro_id.value+'&l_name='+document.getElementById('list_name').value+'&id='+dd.order_id.value+'&class_href='+strh;
//window.open('v1_buy.asp?pro_id='+dd.pro_id.value+'&l_name='+document.getElementById('list_name').value+'&id='+dd.order_id.value+'','_blank','top=5,toolbar=0,location=0,directories=0,menubar=0,scrollbars=0,resizable=0,status=0,copyhistory=0,fullscreen=0');
 //pop.resizeTo(0,0);
doOk();
}else{
	document.getElementById('list_name').value="Name??"
	}
	
	}
function dogoto(strh){
document.location.href="shop_v1.asp?class_id="+strh;
doOk();
	return false;
	}
function sAlert(txt,strh,dvalue,ii){
	
var eSrc=(document.all)?window.event.srcElement:arguments[1];
var shield = document.createElement("DIV");
shield.id = "shield";
shield.style.position = "absolute";
shield.style.left = "0px";
shield.style.top = "0px";
shield.style.width = "100%";
shield.style.height = "100%";
//shield.style.height = ((document.documentElement.clientHeight>document.documentElement.scrollHeight)?document.documentElement.clientHeight:document.documentElement.scrollHeight)+"px";
shield.style.background = "#333";
shield.style.textAlign = "center";
shield.style.zIndex = "1000000";
shield.style.filter = "alpha(opacity=0)";
shield.style.opacity = 0;
var alertFram = document.createElement("DIV");
alertFram.id="alertFram";
alertFram.style.position = "absolute";
alertFram.style.left = "50%";
alertFram.style.top = "40%";
alertFram.style.marginLeft = "-225px" ;
alertFram.style.marginTop = -75+document.documentElement.scrollTop+"px";
alertFram.style.width = "450px";
alertFram.style.height = "150px";
alertFram.style.background = "#ccc";
alertFram.style.textAlign = "center";
alertFram.style.lineHeight = "150px";
alertFram.style.zIndex = "1000001";
strHtml   = "<ul style=\"list-style:none;margin:0px;padding:0px;width:100%;border:4px solid #525252\">\n";
strHtml += " <li style=\"background:#fff;text-align:left;padding-left:20px;font-size:14px;height:40px;font-weight:bold;line-height:40px;border:1px solid #fff;color:#9A7BC7;padding-bottom:10px;\">"+txt+"</li>\n";
//strHtml += " <li style=\"background:#fff;text-align:center;font-size:12px;min-height:40px;height:auto;line-height:20px;border-left:1px solid #fff;border-right:1px solid #fff;padding:0 15px 15px;color:#9A7BC7\"></li>\n";
if(ii==2)
{
	strHtml += " <li style=\"background:#fff;text-align:center;font-size:12px;height:50px;line-height:50px;border-left:1px solid #fff;border-right:1px solid #fff;\">Name: <input type=\"text\" id=\"list_name\" onclick=\"if(this.value=='My Ondormi') this.value=''\" onblur=\"if(this.value=='') this.value='My ondormi'\" value=\""+dvalue+"\"   /></li>\n";
	strHtml += " <li style=\"background:#fff;text-align:center;font-weight:bold;height:25px;line-height:25px; border:1px solid #fff;\"><input type=\"button\"  value=\"Submit\" id=\"do_OK\" onclick=\"buyhrefa();\" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type=\"button\"  value=\"Close\" id=\"do_OK\" onclick=\"doOk();stoprefresh_okv=false;\" /></li>\n";
	strHtml += " <li style=\"background:#fff;text-align:center;font-size:12px;min-height:20px;height:auto;line-height:20px;border-left:1px solid #fff;border-right:1px solid #fff;color:#9A7BC7\"></li>\n";
}
else
{
	if (strh<=0 || strh==""){
	strHtml += " <li style=\"background:#fff;text-align:center;font-size:12px;height:50px;line-height:50px;border-left:1px solid #fff;border-right:1px solid #fff;\">Name: <input type=\"text\" id=\"list_name\" onclick=\"if(this.value=='My Ondormi') this.value=''\" onblur=\"if(this.value=='') this.value='My ondormi'\" value=\""+dvalue+"\"   /></li>\n";
	strHtml += " <li style=\"background:#fff;text-align:center;font-weight:bold;height:25px;line-height:25px; border:1px solid #fff;\"><input type=\"button\"  value=\"Submit\" id=\"do_OK\" onclick=\"hrefa();\" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type=\"button\"  value=\"Close\" id=\"do_OK\" onclick=\"doOk();stoprefresh_okv=false;\" /></li>\n";
	strHtml += " <li style=\"background:#fff;text-align:center;font-size:12px;min-height:20px;height:auto;line-height:20px;border-left:1px solid #fff;border-right:1px solid #fff;color:#9A7BC7\"></li>\n";
	}else{
	strHtml += " <li style=\"background:#fff;text-align:center;font-size:12px;height:50px;line-height:50px;border-left:1px solid #fff;border-right:1px solid #fff;\">Name: <input type=\"text\" id=\"list_name\" onclick=\"if(this.value=='My Ondormi') this.value=''\" onblur=\"if(this.value=='') this.value='My Ondormi'\" value=\""+dvalue+"\"   /></li>\n";
	strHtml += " <li style=\"background:#fff;text-align:center;font-weight:bold;height:25px;line-height:25px; border:1px solid #fff;\"><input type=\"button\"  value=\" Yes \" id=\"do_OK\" onclick=\"hrefa("+strh+");\" /> &nbsp;&nbsp;&nbsp; <input type=\"button\"  value=\" No \" id=\"do_OK\" onclick=\"stoprefresh_okv=false;dogoto("+strh+");\" /></li>\n";
	}
}
strHtml += "</ul>\n";
alertFram.innerHTML = strHtml;
document.body.appendChild(alertFram);
document.body.appendChild(shield);
this.setOpacity = function(obj,opacity){
   if(opacity>=1)opacity=opacity/100;
   try{ obj.style.opacity=opacity; }catch(e){}
   try{ 
    if(obj.filters.length>0&&obj.filters("alpha")){
     obj.filters("alpha").opacity=opacity*100;
    }else{
     obj.style.filter="alpha(opacity=\""+(opacity*100)+"\")";
    }
   }catch(e){}
}
var c = 0;
this.doAlpha = function(){
   if (++c > 20){clearInterval(ad);return 0;}
   setOpacity(shield,c);
}
var ad = setInterval("doAlpha()",1);
this.doOk = function(){
   //alertFram.style.display = "none";
   //shield.style.display = "none";
   document.body.removeChild(alertFram);
   document.body.removeChild(shield);
   eSrc.focus();
   document.body.onselectstart = function(){return true;}
   document.body.oncontextmenu = function(){return true;}
}
document.getElementById("do_OK").focus();
eSrc.blur();
document.body.onselectstart = function(){return false;}
document.body.oncontextmenu = function(){return false;}
}