﻿
//-----------------------------------------------------------------备用信息-----------------------------------------------------------------------------

/*
if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0))
{alert('你是使用IE')}
else if (navigator.userAgent.indexOf('Firefox') >= 0)
{alert('你是使用Firefox')}
else if (navigator.userAgent.indexOf('Opera') >= 0)
{alert('你是使用Opera')}
else{alert('你是使用其他的浏览器浏览网页！')}
*/

//-----------------------------------------------------------------公共函数-----------------------------------------------------------------------------

//获取网站域名目录
function GetWebRoute()
{
  return "http://adserver.jxdyf.com/";
}

//-----------------------------------------------------------------图形广告-----------------------------------------------------------------------------

//展示图形广告
function ShowAd(interiorAdSizeName,interiorAdSortCode,interiorAdDataKeyWord,interiorAdDataCode,topCount,style)
{
  if(interiorAdSizeName==""){alert('广告尺寸不能为空');return;}
  if(interiorAdSortCode==""){alert('广告分类不能为空');return;}
  var width=interiorAdSizeName.split('_')[0];//宽度
  var height=interiorAdSizeName.split('_')[1];//高度
  document.writeln("<iframe id=ifrmAdGui name=ifrmAdGui");
  document.writeln(" src="+GetWebRoute()+"AdServer/AdStyle/Gui/"+style+"/Default.aspx"+
  "?InteriorAdSizeName="+interiorAdSizeName+
  "&InteriorAdSortCode="+interiorAdSortCode+
  "&InteriorAdDataKeyWord="+interiorAdDataKeyWord+
  "&InteriorAdDataCode="+interiorAdDataCode+
  "&topCount="+topCount);
  //document.writeln(" frameborder=0 scrolling=no width=1200 height=800>");
  document.writeln(" frameborder=0 scrolling=no width="+width+" height="+height+">");
  document.writeln("</iframe>");
}

//单击图形广告
function ClickAd(interiorAdDataCode,interiorAdDataOpenTarget,clickUrl)
{
  if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0))//IE浏览器
  {
    var xh = new ActiveXObject("MSXML2.XMLHTTP");
    xh.open("POST","../../../AdGuiEvent.aspx?InteriorAdDataCode="+interiorAdDataCode+"&ClickUrl="+clickUrl+"&Result=1",false);
    xh.send("");
    if(xh.responseText!=""){window.open(xh.responseText,interiorAdDataOpenTarget);}else{alert('广告不存在');}
  }
  else
  {
    window.open("../../../AdGuiEvent.aspx?InteriorAdDataCode="+interiorAdDataCode+"&ClickUrl="+clickUrl+"&Result=0",interiorAdDataOpenTarget)
  }
}

//展示图形广告
function ShowAdGui(interiorAdSizeName,interiorAdSortCode,interiorAdDataKeyWord,interiorAdDataCode,topCount,style)
{
  ShowAd(interiorAdSizeName,interiorAdSortCode,interiorAdDataKeyWord,interiorAdDataCode,topCount,style);
}

//单击图形广告
function ClickAdGui(interiorAdDataCode,interiorAdDataOpenTarget,clickUrl)
{
  ClickAd(interiorAdDataCode,interiorAdDataOpenTarget,clickUrl);
}


//-----------------------------------------------------------------文本广告-----------------------------------------------------------------------------

//展示文本广告
function ShowAdTxt(width,height,titleWordCount,interiorAdSortCode,interiorAdDataKeyWord,topCount,style,backGroundColor)
{
  var width=width;//宽度
  var height=height;//高度
  document.writeln("<iframe id=ifrmAdTxt name=ifrmAdTxt");
  document.writeln(" src="+GetWebRoute()+"AdServer/AdStyle/Txt/"+style+"/Default.aspx"+
  "?TitleWordCount="+titleWordCount+
  "&InteriorAdSortCode="+interiorAdSortCode+
  "&InteriorAdDataKeyWord="+interiorAdDataKeyWord+
  "&TopCount="+topCount+
  "&BackGroundColor="+backGroundColor);
  //document.writeln(" frameborder=0 scrolling=no width=1200 height=800>");
  document.writeln(" frameborder=0 scrolling=no width="+width+" height="+height+">");
  document.writeln("</iframe>");
}

//单击文本广告
function ClickAdTxt(interiorAdDataCode,interiorAdDataOpenTarget,clickUrl)
{
 if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0))//IE浏览器
  {
    var xh = new ActiveXObject("MSXML2.XMLHTTP");
    xh.open("POST","../../../AdTxtEvent.aspx?InteriorAdDataCode="+interiorAdDataCode+"&ClickUrl="+clickUrl+"&Result=1",false);
    xh.send("");
    if(xh.responseText!=""){window.open(xh.responseText,interiorAdDataOpenTarget);}else{alert('广告不存在');}
  }
  else
  {
    window.open("../../../AdTxtEvent.aspx?InteriorAdDataCode="+interiorAdDataCode+"&ClickUrl="+clickUrl+"&Result=0",interiorAdDataOpenTarget)
  }
}