﻿function setSearchAdsense(_1,_2,_3){
_setAdsenseDisplayWithID(_1,"SearchAdsense",_2,_3);
}
function setListTopAdsense(_4,_5,_6,_10){
_setAdsenseDisplayRowWithID(_4,"ListTopAdsense",_5,_6,_10);
}
function setListFootAdsense(_7,_8,_9,_11){
_setAdsenseDisplayRowWithID(_7,"ListFootAdsense",_8,_9,_11);
}
function setDetailTopAdsense(_12,_13,_14){
_setAdsenseDisplayDetailWithID(_12,"DetailTopAdsense",_13,_14);
}
function setProductTopAdsense(_15,_16,_17,s1,s2,s3,s4){
_setAdsenseProductDetailWithID(_15,"ProductTopAdsense",_16,_17,s1,s2,s3,s4);
}
function setProductMiddleAdsense(_37,_38,_39,s5,s6,s7,s8){
_setAdsenseProductDetailWithID(_37,"ProductMiddleAdsense",_38,_39,s5,s6,s7,s8);
}
function setProductBottomAdsense(_34,_35,_36,s9,s10,s11,s12){
_setAdsenseProductDetailWithID(_34,"ProductBottomAdsense",_35,_36,s9,s10,s11,s12);
}

function _setAdsenseDisplayWithID(_19,id,_1b,end){
var s=_setAdsenseDisplay(_19,_1b,end);
if(s!=null){
var _1e=document.getElementById(id);
if(_1e!=null){
_1e.innerHTML=s;
}
}
}
function _setAdsenseDisplay(_1f,_20,end){
var s="";
var i;
if(_1f.length==0){
return;
}
if(end>_1f.length){
end=_1f.length;
}
if(_20>=end){
return;
}
s+="<div class=\"spsch\">";
for(i=_20;i<end;i++){
var a="<a href=\""+_1f[i].url+"\" onclick=\"return popWindow('"+_1f[i].url+"','AdSense',800,600)\" onmouseout=\"window.status=''\" "+"onmouseover=\"window.status='go to "+_1f[i].visible_url+"'; return true;\" "+"style=\"text-decoration:none\">";
s+="<div>"+a+"<strong>"+_1f[i].line1+"</strong></a></div>";
s+="<div class=\"spschtxt\">"+a+_1f[i].line2+" "+(_1f[i].line3?_1f[i].line3:"")+"</a></div>";
s+="<div class=\"spschlink\">"+a+_1f[i].visible_url+"</a></div>";
}
s+="</div>";
return s;
}

function _setAdsenseDisplayRowWithID(_21,id1,_2b,end1,_23){
var s=_setAdsenseRowDisplay(_21,_2b,end1,_23);
if(s!=null){
var _2e=document.getElementById(id1);
if(_2e!=null){
_2e.innerHTML=s;
}}}
function _setAdsenseRowDisplay(_2f,_22,end1,_24){
var s="";
var i;
if(_2f.length==0){
return;
}
if(end1>_2f.length){
end1=_2f.length;
}
if(_22>=end1){
return;
}
s+="<div class=\""+_24+"\" style=\"margin:10px 0 0;\"><div class=\"lgtitle\">"+adsense_title+"</div>";
for(i=_22;i<end1;i++){
var a="<a href=\""+_2f[i].url+"\" onclick=\"return popWindow('"+_2f[i].url+"','AdSense',800,600)\" onmouseout=\"window.status=''\" "+"onmouseover=\"window.status='go to "+_2f[i].visible_url+"'; return true;\" "+"style=\"text-decoration:none\">";
s+="<div class=\"lgshow\"><div class=\"lgt1\">"+a+""+_2f[i].line1+"</a></div>";
s+="<div class=\"lgt2\">"+a+_2f[i].line2+" "+(_2f[i].line3?_2f[i].line3:"")+"</a></div>";
s+="<div class=\"lgt3\">"+a+_2f[i].visible_url+"</a></div></div>";
}
s+="</div>";
return s;
}
function _setAdsenseDisplayDetailWithID(_25,id2,_3b,end2){
var s=_setAdsenseDisplayDetail(_25,_3b,end2);
if(s!=null){
var _3e=document.getElementById(id2);
if(_3e!=null){
_3e.innerHTML=s;
}}}
function _setAdsenseDisplayDetail(_3f,_26,end2){
var s="";
var i;
if(_3f.length==0){
return;
}
if(end2>_3f.length){
end2=_3f.length;
}
if(_26>=end2){
return;
}
s+="<div class=\"sglshow\"><div class=\"sglinfo\">";
for(i=_26;i<end2;i++){
var a="<a href=\""+_3f[i].url+"\" onclick=\"return popWindow('"+_3f[i].url+"','AdSense',800,600)\" onmouseout=\"window.status=''\" "+"onmouseover=\"window.status='go to "+_3f[i].visible_url+"'; return true;\" "+"style=\"text-decoration:none\">";
s+="<div class=\"sgld\"><div class=\"sglt1\">"+a+""+_3f[i].line1+"</a></div>";
s+="<div class=\"sglt2\">"+a+_3f[i].line2+" "+(_3f[i].line3?_3f[i].line3:"")+"</a></div>";
s+="<div class=\"sglt3\">"+a+_3f[i].visible_url+"</a></div></div>";
}
s+="</div></div>";
return s;
}
function _setAdsenseProductDetailWithID(_30,id4,_4b,end4,s13,s14,s15,s16){
var s=_setAdsenseDisplayProductDetail(_30,_4b,end4,s13,s14,s15,s16);
if(s!=null){
var _4e=document.getElementById(id4);
if(_4e!=null){
_4e.innerHTML=s;
}}}
function _setAdsenseDisplayProductDetail(_4f,_31,end4,s17,s18,s19,s20){
var s="";
var i;
if(_4f.length==0){
return;
}
if(end4>_4f.length){
end4=_4f.length;
}
if(_31>=end4){
return;
}
for(i=_31;i<end4;i++){
var a="<a href=\""+_4f[i].url+"\" onclick=\"return popWindow('"+_4f[i].url+"','AdSense',800,600)\" onmouseout=\"window.status=''\" "+"onmouseover=\"window.status='go to "+_4f[i].visible_url+"'; return true;\" "+"style=\"text-decoration:none\">";
s+="<div class=\""+s17+"\"><div class=\""+s18+"\">"+a+""+_4f[i].line1+"</a></div>";
s+="<div class=\""+s19+"\">"+a+_4f[i].line2+" "+(_4f[i].line3?_4f[i].line3:"")+"</a></div>";
s+="<div class=\""+s20+"\">"+a+_4f[i].visible_url+"</a></div></div>";
}
return s;
}

function popWindow(url,_28,w,h){
newwindow=window.open(url,_28,"height="+h+",width="+w+",resizable=yes,scrollbars=yes,toolbar=yes,status=yes,menubar=yes,location=yes");
if(window.focus){
newwindow.focus();
}
return false;
}


var global_doc = document;
function getViewportHeight() {
if (window.innerHeight!=window.undefined) return window.innerHeight;
if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
if (document.body) return document.body.clientHeight; 
return window.undefined; 
}
function getViewportWidth() {
if (window.innerWidth!=window.undefined) return window.innerWidth; 
if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; 
if (document.body) return document.body.clientWidth; 
return window.undefined; 
}
function gid(id){	return global_doc.getElementById?global_doc.getElementById(id):null;}
function setDivCenter() {
var width, height;
if(!isNaN(parseInt(gid("tgpopup").style.width)))
width = parseInt(gid("tgpopup").style.width);
else
width = gid("tgpopup").offsetWidth;
//height = parseInt(gid("tgpopup").offsetHeight);
height = 230;
var fullHeight = getViewportHeight();
var fullWidth = getViewportWidth();
var scLeft,scTop;
if (self.pageYOffset) {
scLeft = self.pageXOffset;
scTop = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop) {
scLeft = document.documentElement.scrollLeft;
scTop = document.documentElement.scrollTop;
} else if (document.body) {
scLeft = document.body.scrollLeft;
scTop = document.body.scrollTop;
}
var topMargin = scTop + ((fullHeight - height) / 2);
if (topMargin < 0) { topMargin = 0; }
gid("tgpopup").style.top = topMargin + "px";
gid("tgpopup").style.left =  (scLeft + ((fullWidth - width) / 2)) + "px";
}
function ShowGroupBuying()
{
var db=document.body;
gid("div_lay").style.height=db.scrollHeight>db.offsetHeight ? db.scrollHeight: db.offsetHeight;
gid("div_lay").style.display = "";
setDivCenter();
gid("tgpopup").style.display = "";
}
function HideGroupBuying(){
gid("div_lay").style.display = "none";
gid("tgpopup").style.display = "none";
gid("TxtEmail").value="";
gid("TxtPrice").value="";
}
function GroupBuying()
{
var temp = gid("TxtEmail");var temp1= gid("TxtPrice");
var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
if(temp.value!=""){if(!myreg.test(temp.value)){alert('请输入有效的E_mail！');
TxtEmail.focus();return false;}}
else{ alert('请输入E_mail！');TxtEmail.focus();return false; return false;}
if(temp1.value!=""){
var Letters = "1234567890"; 
var checkChar;
if(temp1.value.length<=0)
{alert("请输入数字！");return false; }
else
{
for(var i = 0; i < temp1.value.length; i ++ ) 
{
checkChar = temp1.value.charAt( i );
if (Letters.indexOf( checkChar) ==-1) 
{alert("请输入数字！");return false; } 
}
}
}
gid("BtnGroupBuying").click();
HideGroupBuying();
}