﻿/*
右下角视频广告设置
*/
//控制右下角是否显示的代码 1 显示， 0 不显示
var rbADIsPop_20100111 = 0; 

//视频地址
var adAddress_20100111 = "http://www.0715es.com/newgg/xqj.wmv";

//用户关闭几次后当天不再显示
var adMaxClose_20100111 = 5;











var the_timeout_20100111;

function rightBottomAd_20100111(){
 var c = parseInt(getCookie("closeDiv_20100111-14"));
 if (isNaN(c) || c==null) c = 0;

 var abc = document.getElementById("eMeng_20100111");
 var wmp = document.getElementById("WindowsMediaPlayer1");
 if (rbADIsPop_20100111 && c<adMaxClose_20100111)
 {
  if (wmp.URL==null || wmp.URL=="") wmp.URL = adAddress_20100111;
  divHeight = parseInt(abc.offsetHeight, 10);
  abc.style.display = 'block';
  abc.style.top = document.documentElement.scrollTop+document.documentElement.clientHeight-divHeight+"px"; 
  the_timeout_20100111 = setTimeout(function(){rightBottomAd_20100111();}, 120);
 }
 else
 {
  abc.style.display = 'none';
  wmp.controls.stop();
  if (the_timeout_20100111) clearTimeout(the_timeout_20100111);
 }
}

function closeDiv_20100111()
{
 var c = parseInt(getCookie("closeDiv_20100111-14"));
 if (isNaN(c) || c==null) c = 0;
 var abc = document.getElementById("eMeng_20100111");
 var wmp = document.getElementById("WindowsMediaPlayer1");
 wmp.controls.stop();
 abc.style.visibility = "hidden";
 if (the_timeout_20100111) clearTimeout(the_timeout_20100111);
 if (c<adMaxClose_20100111) {
   setCookie("closeDiv_20100111-14", c+1, new Date(new Date().getTime() + 1000 * 60 * 60 * 6));
 }
}




function bookmark(){
	var title = document.title;
	var url = document.location.href;
	if (window.sidebar){window.sidebar.addPanel(title, url,"");}
	else if( window.opera && window.print ){
		var mbm = document.createElement('a');
		mbm.setAttribute('rel','sidebar');
		mbm.setAttribute('href',url);
		mbm.setAttribute('title',title);
		mbm.click();}
	else if(document.all){window.external.AddFavorite( url, title);}
}

function tempChat(){
	showModalDialog("http://www.xnie.com/chat.htm", window, "resizable: no; help: no; status: no; scroll: no; dialogHeight: 420px; dialogWidth: 650px;");
}

var countimg = document.createElement('img');
function ggad(o)
{
	var t = new Date().getTime();
	var ot = o.value, oh = o.href;
	var st = "searchs", st1 = 'googlesearch';
	if (typeof(ot)=="undefined")
	{
		ot = o.innerText;
		st = "search";
		st1 = "google";
	}
	ot = encodeURIComponent(ot);
	var cp = encodeURIComponent(window.self.location);
	var u = 'http://www.xnie.com/logad/img.asp?type=' + st + '&' + st + '=' + st1 + '&page=' + cp + '&text=' + ot + '&time=' + t;
	countimg.src = u;
	//window.open(o);
}

function gguad(o)
{
	var t = new Date().getTime();
	var ot = o.value, oh = o.href;
	var st = "searchs", st1 = 'googlesearchunion';
	if (typeof(ot)=="undefined")
	{
		ot = o.innerText;
		st1 = "googlesearchunion";
	}
	ot = encodeURIComponent(ot);
	var cp = encodeURIComponent(window.self.location);
	var u = 'http://www.xnie.com/logad/img.asp?type=' + st + '&' + st + '=' + st1 + '&page=' + cp + '&text=' + ot + '&time=' + t;
	countimg.src = u;
	//window.open(o);
}

function checkS()
{
	var sbb = document.getElementById("sbi");
	if (sbb.value.length<1)
	{
		alert("输入关键字。");

		return false;
	}else {
		ggad(sbb);
	}
}


function setCookie(cookieName, cookieValue, expires, path, domain, secure) {
	document.cookie = escape(cookieName) + '=' + escape(cookieValue) + (expires ? '; expires=' + expires.toGMTString() : '') + (path ? '; path=' + path : '') + (domain ? '; domain=' + domain : '') + (secure ? '; secure' : '');
}

function getCookie(cookieName) {
	var cookieValue = '';
	var posName = document.cookie.indexOf(escape(cookieName) + '=');
    //document.write(document.cookie);
	if (posName != -1) {
		var posValue = posName + (escape(cookieName) + '=').length;
		var endPos = document.cookie.indexOf(';', posValue);
		if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));
		else cookieValue = unescape(document.cookie.substring(posValue));
	}
	return (cookieValue);
}
