//弹出框框
//防止操作未完成
var titleRealName="查看信息";
function fz(obj,BoolIsParentIs){ 
 if(obj==1){
   var sWidth,sHeight; 
   
   var dde = document.documentElement;
   	
    if (window.innerWidth)
    {        
        sHeight= window.innerHeight;        
    }
    else
    {        
        sHeight= dde.offsetHeight;        
    }
    
   sWidth=document.body.offsetWidth-2; 
   sHeight=sHeight-2;
   var bgObj=document.createElement("div"); 
   bgObj.setAttribute('id','fzShowMsgDiv'); 
   bgObj.style.position="absolute"; 
   bgObj.style.top="0"; 
   bgObj.style.background="#777"; 
   bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=75,finishOpacity=25"; 
   bgObj.style.opacity="0.6"; 
   bgObj.style.left="0"; 
   bgObj.style.width=sWidth + "px"; 
   bgObj.style.height=sHeight + "px"; 
   bgObj.style.zIndex = "10000"; 
   document.body.appendChild(bgObj);
 }else{
	  if(BoolIsParentIs==false){
		 var bgDiv=document.getElementById("fzShowMsgDiv");	 
		 document.body.removeChild(bgDiv);
	  }else{
		 for(var i=0;i<document.frames.length;i++){
		     var TempDocument=document.frames[i].document.getElementById("fzShowMsgDiv");
			 if(TempDocument!=null){
				    document.frames[i].document.body.removeChild(document.frames[i].document.getElementById("fzShowMsgDiv"));
					break;
				 }
		  }		 
	  }
 }
}
function setTitleRealName(titleName)
{
    titleRealName=titleName;
    parent.document.getElementById("divtitle").innerHTML=titleRealName;
}

function ShowShangJiChoice(title,pathhtml,TopValue,leftValue,kwd){
   titleRealName=title;
   var sWidth,sHeight; 
   sWidth=680; 
   sHeight=500;     
   var v_left=leftValue;
   var v_top=TopValue+"px";  
   var ShowChoiceDiv=null;
  
   ShowChoiceDiv=document.createElement("div"); 
  
   ShowChoiceDiv.setAttribute('id','ShowDilagModeDiv'); 
   ShowChoiceDiv.style.position="absolute"; 
   ShowChoiceDiv.style.top=v_top;
   ShowChoiceDiv.style.background="#ffffff";    
   //ShowChoiceDiv.style.opacity="0.6"; 
   ShowChoiceDiv.style.left=v_left+ "px"; 
   ShowChoiceDiv.style.width=sWidth + "px"; 
   ShowChoiceDiv.style.height=sHeight + "px"; 
   ShowChoiceDiv.style.zIndex = "10001";
   ShowChoiceDiv.className="TanChuDiv";
  
    document.body.appendChild(ShowChoiceDiv); 
     
    var html="<div class=\"TanChuDiv1\"><div class=\"TanChuDiv2\"><div class=\"TanChuDiv3\"><div class=\"TanChuDivTitle\" onmousedown=\"moveStart(event,'ShowDilagModeDiv');\" style=\"cursor:move;\"><div class=\"TanChuDivTitleLeft\"  titile=\"移动窗口\" ><div class=\"TanChuImgClass\" title=\""+titleRealName+"\"></div><div class=\"TanChuImgTxt\"><span id=\"divtitle\"><b>"+titleRealName+"<b></span></div></div><div class=\"TanChuDivTitleRight\"><img src=\"images/24.jpg\" alt=\"关闭\" onmouseout=\"showdivclose(2,this)\" onmouseover=\"showdivclose(1,this)\" onclick=\"FishChoice()\"/></div></div><div class=\"TxtFind\">&nbsp;&nbsp;Googie:<font color='red'><a href=\""+pathhtml+"\"target=\"_blank\" title=\"Googie:"+kwd+"\">"+kwd+"</span></font></div>";
    html+="<div id=\"ShowDilagModeDivChild\" class=\"TanChuDivIfrmae\"><iframe name=\"ShowDivIframe\" id=\"ShowDivIframeYY\" src=\""+pathhtml+"\" frameborder=\"0\" width=\"680\" height=\"455\" onload=\"Javascript:SetShowDivHeight(this)\" ></iframe></div></div></div>";
	
    document.getElementById('ShowDilagModeDiv').innerHTML=html;
	
}
function FishChoice(){	
		 var ShowChoiceDiva=document.getElementById("ShowDilagModeDiv");;
		 if(ShowChoiceDiva!=null&&ShowChoiceDiva!="undefined"){
		  document.body.removeChild(ShowChoiceDiva);
		  //fz(2,BoolIsParentIs);
		 }

}

function ShowMuiscDown(title,pathhtml){
   titleRealName=title;
   var sWidth,sHeight; 
   sWidth=510; 
   sHeight=360;     
   var v_left=(document.body.clientWidth-sWidth)/2+document.body.scrollLeft;
   var v_top=(document.body.clientHeight-sHeight)/2+document.body.scrollTop-150;  

   var ShowChoiceDiv=null;
  
   ShowChoiceDiv=document.createElement("div"); 
  
   ShowChoiceDiv.setAttribute('id','ShowDilagModeDiv'); 
   ShowChoiceDiv.style.position="absolute"; 
   ShowChoiceDiv.style.top=v_top;
   ShowChoiceDiv.style.background="#ffffff";    
   //ShowChoiceDiv.style.opacity="0.6"; 
   ShowChoiceDiv.style.left=v_left+ "px"; 
   ShowChoiceDiv.style.width=sWidth + "px"; 
   ShowChoiceDiv.style.height=sHeight + "px"; 
   ShowChoiceDiv.style.zIndex = "10001";
   ShowChoiceDiv.className="TanChuDiv";
  
    document.body.appendChild(ShowChoiceDiv); 
     
    var html="<div class=\"TanChuDiv1\"><div class=\"TanChuDiv2\"><div class=\"TanChuDiv3\"><div class=\"TanChuDivTitle\" onmousedown=\"moveStart(event,'ShowDilagModeDiv');\" style=\"cursor:move;\"><div class=\"TanChuDivTitleLeft\"  titile=\"移动窗口\" ><div class=\"TanChuImgClass\" title=\""+titleRealName+"\"></div><div class=\"TanChuImgTxt\"><span id=\"divtitle\">"+titleRealName+"</span></div></div><div class=\"TanChuDivTitleRight\"><img src=\"images/24.jpg\" alt=\"关闭\" onmouseout=\"showdivclose(2,this)\" onmouseover=\"showdivclose(1,this)\" onclick=\"FishChoice()\"/></div></div>";
    html+="<div id=\"ShowDilagModeDivChild\" class=\"TanChuDivIfrmae\"><iframe name=\"ShowDivIframe\" id=\"ShowDivIframe\" src=\""+pathhtml+"\" frameborder=\"0\" width=\"100%\" height=\"335\" ></iframe></div></div></div>";
	
    document.getElementById('ShowDilagModeDiv').innerHTML=html;
	
}
function ShowMuiscListen(title,pathhtml){
   titleRealName=title;
   var sWidth,sHeight; 
   sWidth=415; 
   sHeight=160;     
   var v_left=(document.body.clientWidth-sWidth)/2+document.body.scrollLeft;
   var v_top=(document.body.clientHeight-sHeight)/2+document.body.scrollTop-150;  

   var ShowChoiceDiv=null;
  
   ShowChoiceDiv=document.createElement("div"); 
  
   ShowChoiceDiv.setAttribute('id','ShowDilagModeDiv'); 
   ShowChoiceDiv.style.position="absolute"; 
   ShowChoiceDiv.style.top=v_top;
   ShowChoiceDiv.style.background="#ffffff";    
   //ShowChoiceDiv.style.opacity="0.6"; 
   ShowChoiceDiv.style.left=v_left+ "px"; 
   ShowChoiceDiv.style.width=sWidth + "px"; 
   ShowChoiceDiv.style.height=sHeight + "px"; 
   ShowChoiceDiv.style.zIndex = "10001";
   ShowChoiceDiv.className="TanChuDiv";
  
    document.body.appendChild(ShowChoiceDiv); 
     
    var html="<div class=\"TanChuDiv1\"><div class=\"TanChuDiv2\"><div class=\"TanChuDiv3\"><div class=\"TanChuDivTitle\" onmousedown=\"moveStart(event,'ShowDilagModeDiv');\" style=\"cursor:move;\"><div class=\"TanChuDivTitleLeft\"  titile=\"移动窗口\" ><div class=\"TanChuImgClass\" title=\""+titleRealName+"\"></div><div class=\"TanChuImgTxt\"><span id=\"divtitle\">"+titleRealName+"</span></div></div><div class=\"TanChuDivTitleRight\"><img src=\"images/24.jpg\" alt=\"关闭\" onmouseout=\"showdivclose(2,this)\" onmouseover=\"showdivclose(1,this)\" onclick=\"FishChoice()\"/></div></div>";
    html+="<div id=\"ShowDilagModeDivChild\" class=\"TanChuDivIfrmae\"><iframe name=\"ShowDivIframe\" id=\"ShowDivIframe\" src=\""+pathhtml+"\" frameborder=\"0\" width=\"100%\" height=\"133\" ></iframe></div></div></div>";
	
    document.getElementById('ShowDilagModeDiv').innerHTML=html;
	
}
var  DOM  =  (document.getElementById)  ?   1  :  0 ;
var  NS4  =  (document.layers)  ?   1  :  0 ;
var  IE4  =   0 ;
if(document.all)
  {
    IE4  =   1 ;
    DOM  =   0 ;
} 
 var  win  =  window;   
 var  n  =   0 ;

function  findInPage(str)   {
 var  txt, i, found;
 if  (str  ==   "" )
     return   false ;
 if  (DOM)
  {
    win.find(str,  false ,  true );
     return   true ;
} 
  if  (NS4)   {
     if  ( ! win.find(str))
         while (win.find(str,  false ,  true ))
            n ++ ;
     else 
        n ++ ;
     if  (n  ==   0 )
        alert( " 未找到指定内容. " );
} 
  if  (IE4)   {
       txt=win.document.ShowDivIframeYY.document.body.createTextRange();

     for  (i  =   0 ; i  <=  n  &&  (found  =  txt.findText(str))  !=   false ; i ++ )   {
            txt.moveStart("character", 1);
			txt.moveEnd("textedit");
    } 
  if  (found)   {
    txt.moveStart("character", -1);
    txt.findText(str);
    txt.select();
    txt.scrollIntoView();
    n ++ ;
} 
  else    {
     if  (n  >   0 )   {
        n  =   0 ;
        findInPage(str);
    } 
     else 
        alert( " 未找到指定内容. " );
    } 
} 
 return   false ;
} 

/*function FindText(text){
	    var i;
		var n = 0;
		var textRange = document.ShowDivIframeYY.document.body.createTextRange();			
		for (i = 0; i <= n && (found = textRange.findText(text)) != false; i++) 
		{
			textRange.moveStart("character", 1);
			textRange.moveEnd("textedit");
		}
		if (found)
		{
			textRange.moveStart("character", -1);
			textRange.findText(text);
			textRange.select();
			textRange.scrollIntoView();
			n++;
		}

} */     
function wt(txt){
	findInPage(txt);
}
function SetShowDivHeight(cwin)
{
	//alert(cwin.document.body.innerHTML);
	//改变图片样式	
	/*var heightdiv=0,widthdiv=0;
	var IE=getOs();
	if(IE=="Firefox"){
	 	heightdiv=cwin.contentDocument.body.scrollHeight+29;
	    widthdiv=cwin.contentDocument.body.scrollWidth+2;	
		cwin.document.body.style.zoom=0.5;
	}else{
		
	   	heightdiv=cwin.Document.body.scrollHeight+29;
	    widthdiv=cwin.Document.body.scrollWidth+2;
		cwin.document.body.style.zoom=0.5;
	}	
	cwin.style.height=(heightdiv-27)+"px";	
	
	document.getElementById('ShowDilagModeDiv').style.height=heightdiv+"px";
    document.getElementById('ShowDilagModeDiv').style.width=widthdiv+"px";
	 
	var v_left=(document.body.clientWidth-widthdiv)/2+document.body.scrollLeft;
	document.getElementById('ShowDilagModeDiv').style.left=v_left+ "px";*/
		
}
function showdivclose(obj,objthis){
  if(obj==1){
	  objthis.src="images/24-A.jpg";
  }else{
	  objthis.src="images/24.jpg";
  }
}

//弹出框框结束

function ShowDialgDiv(TitleObj,SrcPath,TopValue,leftValue,kwd){
  //先弹出一个层让屏幕变黑
  //fz(1,BoolIsParentIs);   

  ShowShangJiChoice(TitleObj,SrcPath,TopValue,leftValue,kwd);
}


function ShowReturnValue(obj,txtID,valueID)
{   
    try{  
    if(document.getElementById(txtID)!=null&&document.getElementById(valueID)!=null)
    {
    document.getElementById(txtID).value= obj.split("-")[0].Trim();
    document.getElementById(valueID).value= obj.split("-")[1].Trim(); 
    }   
      FishChoice(false);   
      addProductInfo(); 
    }catch(e)
    { 
    }    
}
String.prototype.Trim = function()
{
    return this.replace(/(^\\s*)|(\\s*$)/g, "");
}
String.prototype.LTrim = function()
{
    return this.replace(/(^\\s*)/g, "");
}
String.prototype.RTrim = function()
{
    return this.replace(/(\\s*$)/g, "");
}

function moveStart (event, _sId){ 
var IE=getOs();
	if(IE!="Firefox"){
  var oObj = document.getElementById(_sId);
  oObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=65)"; 
  document.getElementById("ShowDilagModeDivChild").style.display="none";
  oObj.onmousemove = mousemove;
  oObj.onmouseup = mouseup;
  oObj.setCapture ? oObj.setCapture() : function(){};
  oEvent = window.event ? window.event : event;
  var dragData = {x : oEvent.clientX, y : oEvent.clientY};
  var backData = {x : parseInt(oObj.style.top), y : parseInt(oObj.style.left)};
  function mousemove(){
   var oEvent = window.event ? window.event : event;
   var iLeft = oEvent.clientX - dragData["x"] + parseInt(oObj.style.left);
   var iTop = oEvent.clientY - dragData["y"] + parseInt(oObj.style.top);
   oObj.style.left = iLeft;
   oObj.style.top = iTop;
   dragData = {x: oEvent.clientX, y: oEvent.clientY};   
  }
  function mouseup(){
   oObj.style.filter=""; 
    document.getElementById("ShowDilagModeDivChild").style.display="";
   var oEvent = window.event ? window.event : event;
   oObj.onmousemove = null;
   oObj.onmouseup = null;
   if(oEvent.clientX < 1 || oEvent.clientY < 1 || oEvent.clientX > document.body.clientWidth || oEvent.clientY > document.body.clientHeight){
    oObj.style.left = backData.y;
    oObj.style.top = backData.x;
   }
   oObj.releaseCapture ? oObj.releaseCapture() : function(){};
  }
 } 
 }

function getOs() 
{ 
   var OsObject = ""; 
   if(navigator.userAgent.indexOf("MSIE")>0) { 
        return "MSIE"; 
   } 
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ 
        return "Firefox"; 
   } 
   if(isSafari=navigator.userAgent.indexOf("Safari")>0) { 
        return "Safari"; 
   }  
   if(isCamino=navigator.userAgent.indexOf("Camino")>0){ 
        return "Camino"; 
   } 
   if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){ 
        return "Gecko"; 
   } 
   
} 
function GetFunctionFor(functionName){
        var documentOrd=document;       
        for(var i=0;i<parent.document.frames.length;i++){
		     var TempObj=parent.document.frames[i].document.getElementById("fzShowMsgDiv");
			 if(TempObj!=null){
				    parent.document.frames[i].window.eval(functionName);
					break;
				 }
		  }
		  		
}