﻿

//日历
$import("/script/Calendar/WdatePicker.js","js");


//图片展示
$import("/script/lightbox/js/prototype.js","js");
$import("/script/lightbox/js/effects.js","js");
$import("/script/lightbox/js/lightbox.js","js");
//图片轮播
$import("/script/transition/transition.js","js");
//圆角
$import("/script/rounded/nifty.js","js");


var s = top.location.href;
var ss;
	ss = s.substring(s.lastIndexOf("."),s.lastIndexOf("/")+1);
var lang1 = s.search("/cn/");
var lang2 = s.search("/chs/");
if (lang1 == -1 && lang2 == -1){if ($("l_en")) $("l_en").className="active";}

/*使用说明
  lightbox (高亮图片) 调用方式 在图片外A链接上加  rel="lightbox[plants]" plants 是组名 可随便更改 

  圆角函数
  window.onload=function(){
	if(!NiftyCheck()) return;
	Rounded("div#yd_news_info","top","transparent","#DDF2E2","big border #71B781");
	rdl_doInit(); //js 变化效果
  }
	Rounded(selector,wich,bk,color,opt) 圆角函数
	解释:
	selector 指哪个标签要成为圆角 书写方式 [" #nav li"] #号前空一格
	wich     指哪个形式的圆角,书写方式 ["tl br"],
	         分别有 all[四个圆角] top[顶部双圆] bottom[底部双圆] tl[顶部左边] tr[顶部右边] bl[底部左边] br[底部右边]
	bk       指圆角外背景颜色
	color    指圆角内背景颜色
	opt      指圆角边框样式 big[大圆角 默认] small[小圆角] border #f00[定义边框颜色,一定要在16进制颜色值前加 border 的]  
  */

window.onload=function(){
	try{MM_preloadcalendar()}catch(e){}
	resizeLeftPage();

}
function resizeLeftPage(){
	if ($("con_right") && $("con_left")) $("con_left").style.height = $("con_right").clientHeight + 0+ "px";
	if ($("con_left") && $("con_right")) $("con_right").style.height = $("con_left").clientHeight + 0+ "px";
	
	
}

var local_site = top.location.href;
if (local_site.search("/hcrm/") != "-1")
{
	var n_site = "/";
}
else
{
	var n_site = "../"
}

//变化效果  start
var effectDiv = new Array();                    //定义应该效果的 DIV 组 id
	effectDiv[0]="h_pic";
	effectDiv[1]="a_pic";

var slide_content_1_=new Array();                 //第一组首页大图变化效果内容h_pic
	//slide_content_1_[0] = n_site + 'images/picb_01.jpg';
	slide_content_1_[0] = n_site + 'images/yd-i01.jpg';
	slide_content_1_[1] = n_site + 'images/picb_03.jpg';	
	slide_content_1_[2] = n_site + 'images/yd-i02.jpg';
	slide_content_1_[3] = n_site + 'images/yd-i03.jpg';
	slide_content_1_[4] = n_site + 'images/yd-i04.jpg';
	slide_content_1_[5] = n_site + 'images/yd-i05.jpg';

	
var slide_content_2_=new Array();                 //第二组客房大图变化效果内容a_pic
	slide_content_2_[0] = n_site + 'images/yd-i04.jpg';
	slide_content_2_[1] = n_site + 'images/kf-i01.jpg';
	slide_content_2_[2] = n_site + 'images/kf-i02.jpg';
	slide_content_2_[3] = n_site + 'images/kf-i03.jpg';
	slide_content_2_[4] = n_site + 'images/kf-i04.jpg';
	slide_content_2_[5] = n_site + 'images/kf-i05.jpg';




function rdl_play()
{	

	for (i=0;i<effectDiv.length;i++ )
	{
		if ($(effectDiv[i]))
		{
			with ($(effectDiv[i]))
			{
				
				var n = which_content[i];

				//if (document.all) style.filter=effect[rand(effect.length)-1];//随机变化效果与下面的单一变化不能同时存在
				if (document.all) style.filter=effect[12];//单一效果修改这里的数学

				if (document.all) filters[0].Apply();
				
				if (window.slide_content_1_) if (i == 0) style.backgroundImage = "url("+slide_content_1_[n]+")";
				if (window.slide_content_2_) if (i == 1) style.backgroundImage = "url("+slide_content_2_[n]+")";
				if (window.slide_content_3_) if (i == 3) style.backgroundImage = "url("+slide_content_3_[n]+")";
				if (window.slide_content_4_) if (i == 4) style.backgroundImage = "url("+slide_content_4_[n]+")";
				if (window.slide_content_5_) if (i == 5) style.backgroundImage = "url("+slide_content_5_[n]+")";
				
				//alert ("url("+slide_content_2_[n]+")");
				if (document.all) filters[0].play();
			}
		}
	}
}

//变化效果  end
var old_n = "";
function tab(n){
	if ($("log_"+n).style.display == "none")
	{
		$("log_"+n).style.display = "block";
		$("tab_id_"+n).className ="active";
		document.getElementsByTagName("H2")[0].innerHTML = $("tab_id_"+n).innerHTML;
		if ($("tab_id_"+n).innerHTML.search("图") != -1)
		{
			
			if ($("introduction_images")) $("introduction_images").style.display = "none";
		}
		else
		{
			if ($("introduction_images")) $("introduction_images").style.display = "block";
		}
	}
	if (old_n == "")
	{
		old_n = 1;
	}
	if (n != old_n)
	{
		$("log_"+old_n).style.display = "none";
		$("tab_id_"+old_n).className ="";
		//if $("introduction_images") $("introduction_images").style.display = "none";
	}
	old_n = n;
}



var xmlHttp;

function createXMLHttpRequest(){if(window.ActiveXObject){xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}else if(window.XMLHttpRequest){xmlHttp = new XMLHttpRequest();}}

function startRequest(url,id){
	createXMLHttpRequest();
	try{
		xmlHttp.onreadystatechange = function() {
			handleStateChange(id);
		}
		xmlHttp.open("GET", url, true);
		xmlHttp.send(null); 
	}
	catch(exception)
	{
		alert("您要访问的资源不存在!");
	}
}

function handleStateChange(id)
{ 
	if(xmlHttp.readyState == 4)
	{ 
		if (xmlHttp.status == 200 || xmlHttp.status == 0){
		//$(id).innerHTML = xmlHttp.responseText;
		if ($(id)) $(id).insertAdjacentHTML("afterEnd", xmlHttp.responseText); 
		}
	}
}

//鼠标经过河图片预载入
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}







function tq() //天气预报
{	
if (local_site.search("/chs/") != "-1" || local_site.search("/cn/") != "-1")
{
	var tq_lang = "cn";
}
else
{
	var tq_lang = "en";
}
	if($("tq"))
	{
		$("tq").innerHTML = '<iframe frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="/'+tq_lang+'/tq.html" style="width:100px;height:140px;"  allowTransparency="true"></iframe>'; //加载天气预报
		if($("tq")) if($("tq").innerHTML != "正在读取天气预报............") clearInterval(tq_n);
	}
}
if (window.onload) var tq_n = setInterval("tq()",3000);




function load_script(){
	try{container()}catch(e){}
	try{rdl_doInit()}catch(e){};

	}










//id对象获取
function $() {var elements = new Array();for (var i = 0; i < arguments.length; i++) {var element = arguments[i];if (typeof element == 'string') element = document.getElementById(element);if (arguments.length == 1) return element;elements.push(element);}return elements;}
function uncompile(code) //解密
{ 
	code=unescape(code); 
	var c=String.fromCharCode(code.charCodeAt(0)-code.length); 
	for(var i=1;i<code.length;i++){ 
	c+=String.fromCharCode(code.charCodeAt(i)-c.charCodeAt(i-1)); 
	} 
	return c; 
}

function $import(path, type){
  if (type == "css") {
      document.write("<" + "link rel=\"stylesheet\" rev=\"stylesheet\" href=\"" + path + "\" type=\"text/css\" media=\"screen\" />");
  } else {
      document.write("<" + "script src=\"" + path + "\" type=\"text/javascript\"></" + "script>");
  }
}
function killErrors() { 
return true; 
} 
//window.onerror = killErrors; 