﻿function GetValue(key, defaultvalue)
{
  if (defaultvalue==null) defaultvalue=null;
  if (window.location.search==null || key==null) return defaultvalue;
  var QueryString = unescape(window.location.search.substr(1, window.location.search.length));
  if ((iStart=QueryString.indexOf(key+"=", 0))==-1) return defaultvalue;
  iStart += key.length+1;
  iCount = QueryString.indexOf("&", iStart)==-1 ? QueryString.length-iStart : QueryString.indexOf("&", iStart)-iStart;
  return QueryString.substr(iStart, iCount);
}
function GetStrVal(key, str)
{
  if (str==null || key==null) return null;
  if ((iStart=str.indexOf(key+"=", 0))==-1) return null;
  iStart += key.length+1;
  iCount = str.indexOf("&", iStart)==-1 ? str.length-iStart : str.indexOf("&", iStart)-iStart;
  return str.substr(iStart, iCount);
}
function parseDate(str)
{
  if(typeof str == 'string')
  {
    var results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);
    if(results && results.length>3)
      return new Date(__parseInt(results[1]),__parseInt(results[2]) -1,__parseInt(results[3])); 
    results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/);
    if(results && results.length>6)
      return new Date(__parseInt(results[1]),__parseInt(results[2]) -1,__parseInt(results[3]),__parseInt(results[4]),__parseInt(results[5]),__parseInt(results[6]));
    results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/);
    if(results && results.length>7)
      return new Date(__parseInt(results[1]),__parseInt(results[2]) -1,__parseInt(results[3]),__parseInt(results[4]),__parseInt(results[5]),__parseInt(results[6]),__parseInt(results[7]));
  }
  return null;
}
function TextEllipsis(text, len) {return (text.length>len ? text.substr(0,len-1)+'…': text);}
function DBC2SBC(str)     
{     
  var i;
  var result=''; 
  if (str != null && str.length>0)
  {
    for(i=0;i<str.length;i++)
    {
      str1 = str.charCodeAt(i);
      if((str1>=125 && str1<= 19968) || str1>40959)
        result += String.fromCharCode(str1 == 12288 ? 32 : str.charCodeAt(i)-65248);
      else
        result += str.substring(i,i+1);
    }
  }
  return result;
}
function Trim(str){return str.replace(/^( |[\s　])+|( |[\s　])+$/g, "");}

/*function showDynamicAd()
{
var pic_width=985; //图片宽度
var pic_height=357; //图片高度
var button_pos=4; //按扭位置 1左 2右 3上 4下
var stop_time=8000; //图片停留时间(1000为1秒钟)
var show_text=0; //是否显示文字标签 1显示 0不显示
var txtcolor="000000"; //文字色
var bgcolor="FFFFFF"; //背景色
var imag=[];
var link=[];
var text=[];
imag.push("/images/v6_ad_03.jpg");
link.push("http://www.laahome.com");
text.push("拉斐尔");

imag.push("/images/v6_ad_04.jpg");
link.push("http://www.laahome.com");
text.push("莱茵河");

imag.push("/images/v6_ad_01.jpg");
link.push("http://www.laahome.com");
text.push("奥柔莎");
 
imag.push("/images/v6_ad_02.jpg");
link.push("http://www.laahome.com");
text.push("雅典娜");

imag.push("/images/v6_ad_05.jpg");
link.push("http://www.laahome.com");
text.push("阿尔卑斯");

var swf_height=show_text==1?pic_height+20:pic_height;
var pics=imag.join("|");
var links=link.join("|");
var texts=text.join("|");
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cabversion=6,0,0,0" width="'+ pic_width +'" height="'+ swf_height +'">');
document.write('<param name="movie" value="/images/dynamic_ad.swf">');
document.write('<param name="quality" value="high"><param name="wmode" value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&pic_width='+pic_width+'&pic_height='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'">');
document.write('<embed wmode="transparent" src="/images/dynamic_ad.swf" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&pic_width='+pic_width+'&pic_height='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'" quality="high" width="'+ pic_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
}
*/

function showDynamicAd()
{
	var swf_width=985
	var swf_height=357
	var config='5|0x5c5c5c|0x595959|0|0xffffff|0xff0000|0x5c5c5c'
	// config 设置分别为: 自动播放时间(秒)|文字颜色|文字背景色|文字背景透明度|按键数字色|当前按键色|普通按键色
var imag=[];
var link=[];
var text=[];
imag.push("/images/v6_ad_03.jpg");
link.push("http://www.laahome.com");
//text.push("拉斐尔");

imag.push("/images/v6_ad_04.jpg");
link.push("http://www.laahome.com");
//text.push("莱茵河");

imag.push("/images/v6_ad_01.jpg");
link.push("http://www.laahome.com");
//text.push("奥柔莎");
 
imag.push("/images/v6_ad_02.jpg");
link.push("http://www.laahome.com");
//text.push("雅典娜");

imag.push("/images/v6_ad_05.jpg");
link.push("http://www.laahome.com");
//text.push("阿尔卑斯");
	var files=imag.join("|");
	var links=link.join("|");
	var texts=text.join("|");
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">');
	document.write('<param name="movie" value="/images/picshow.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="false" />');
	document.write('<param name=wmode value="opaque" />');
	document.write('<param name="FlashVars" value="config='+config+'&bcastr_flie='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'" />');
	document.write('<embed src="/images/picshow.swf" wmode="opaque" FlashVars="config='+config+'&bcastr_flie='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'& menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function floatNotice()
{
  window._floatObj = this;
  //this.xVal=-2, 
  this.yVal=1, this.delay=50;
  this.obj = document.getElementById("divNotice");
  //this.x = this.obj.offsetLeft, 
  this.y = this.obj.offsetTop;
  this.float=function() {
    //var sl = document.documentElement.scrollLeft || document.body.scrollLeft;
    var st = document.documentElement.scrollTop || document.body.scrollTop;
    //var cw = document.documentElement.clientWidth || document.body.clientWidth;
    var ch = document.documentElement.clientHeight || document.body.clientHeight;

    /*if(this.x + this.obj.offsetWidth - sl + this.xVal > cw)
      this.xVal = -2;

    if(this.x + this.xVal < sl)
      this.xVal = 2;
*/

    if(this.y + this.obj.offsetHeight /*- st*/ + this.yVal > ch)
      this.yVal = -1;
    //if(this.y + this.yVal < st)
    if (this.y + this.yVal <0)
      this.yVal = 1;

    //this.x += this.xVal
    this.y += this.yVal;
    //this.obj.style.left = this.x + "px";
    this.obj.style.top = this.y + "px";
  };
  this.itl = setInterval(this.float, this.delay);
  this.obj.onmouseover=function(){clearInterval(window._floatObj.itl);};
  this.obj.onmouseout=function(){window._floatObj.itl=setInterval(window._floatObj.float, window._floatObj.delay);};
}
