﻿//输入框默认提示文字的清空和重置
function trySetDefaultText(obj,txt){
	if(obj.value==""){
		obj.value = txt;
	}
}
function tryClearDefaultText(obj,txt){
	if(obj.value==txt){
		obj.value = '';
	}
}

//提示信息框的显示
function $(id){return document.getElementById(id)}
function checkform(a){
 var posx=0,posy=0;
   posx = (document.body.scrollWidth - 280)/2;
   posy = document.body.scrollTop + (window.screen.availHeight-500)/2;
   with ($(a).style){
    display='block';
    top = posy+"px";
    left = posx+"px";
  }
}

//提示信息框的背景Iframe的显示
function initBK(){
  var o = document.createElement('iframe');
  o.id = 'framBk';
  o.className = 'iframeBox';
  document.body.appendChild(o);
}

//提示信息框的显示
function checkform2(){
 var posx=0,posy=0;
   posx = (document.body.scrollWidth - 280)/2;
   posy = document.body.scrollTop + (window.screen.availHeight-500)/2;
   
  if (document.all){
    if (!$('framBk')){initBK();}
    with ($('framBk').style){
      display='block';
      top = posy +"px";
      left = posx +4 +"px";
    }
  }
  with ($('infoBox').style){
    display='block';
    top = posy+"px";
    left = posx+"px";
  }
}
function closeform2()
{
    if($('framBk')){
    	$('framBk').style.display='none';
    	}
	$('infoBox').style.display='none';
}

//得到绝对位置
function getAbsoluteLeft( ob ){
 if(!ob){return null;}
   var mendingOb = ob;
   var mendingLeft = mendingOb.offsetLeft;
   while( mendingOb != null && mendingOb .offsetParent != null && mendingOb .offsetParent.tagName != "BODY" ){
     mendingLeft += mendingOb.offsetParent.offsetLeft;
     mendingOb = mendingOb.offsetParent;
   }
 return mendingLeft ;
}
function getAbsoluteTop( ob ){
 if(!ob){return null;}
 var mendingOb = ob;
 var mendingTop = mendingOb.offsetTop;
 while( mendingOb != null && mendingOb.offsetParent != null && mendingOb.offsetParent.tagName != "BODY" ){
   mendingTop += mendingOb.offsetParent.offsetTop;
   mendingOb = mendingOb.offsetParent;
 }
 return mendingTop ;
}

//弹出职位等信息的层
function popDiv(e)
{
   var posx = getAbsoluteLeft(e);
   var posy = getAbsoluteTop(e);
   if (document.all){
    if (!$('framBk')){initBK();}
    with ($('framBk').style){
      display='block';
      top = posy+"px";
      left = posx+ 30 +"px";
    }
  }
  with ($('popDiv').style){
    display='block';
    top = posy+"px";
    left = posx+ 15 +"px";
  }
}
function closePopDiv()
{
	if ($('framBk')){$('framBk').style.display='none';}
	$('popDiv').style.display='none';
}

//详细信息
function showParticularDiv(a,e)
{
   var posx = getAbsoluteLeft(e);
   var posy = getAbsoluteTop(e);
   with ($(a).style){
    display='block';
    top = posy+"px";
    left = posx+ e.offsetWidth +"px";
  }
}
function closeParticularDiv(a){
$(a).style.display='none';
}
//PNG透明图片
function correctPNG()
{
  for(var i=0; i<document.images.length; i++)
  {
   var img = document.images[i]
   var imgName = img.src.toUpperCase()
   if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
   {
   var imgID = (img.id) ? "id='" + img.id + "' " : ""
   var imgClass = (img.className) ? "class='" + img.className + "' " : ""
   var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
   var imgStyle = "display:inline-block;" + img.style.cssText
   if (img.align == "left") imgStyle = "float:left;" + imgStyle
   if (img.align == "right") imgStyle = "float:right;" + imgStyle
   if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
   var strNewHTML = "<span " + imgID + imgClass + imgTitle
   + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
   + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
   + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
   img.outerHTML = strNewHTML
   i = i-1
   };
  };
}
if(navigator.userAgent.indexOf("MSIE")>-1) 
{ 
window.attachEvent("onload", correctPNG); 
}; 

//图片轮换显示
var turnId = 0;
var turnShow;
function nowShow(id){ 
 $('nowShowImg').src = picarry[id];
 $('nowLink').href = lnkarry[id];
 $('nowShowText').innerHTML = "<a href=\""+lnkarry[id]+"\" class=\"whiteSmallText\" >"+ttlarry[id]+"</a>";
 turnId = id;
 for( var i=0;i<5; i++){
  $("tImg" + i).className = "otherSmallImgBoxDIV";
 };
 $("tImg" + id).className = "onSmallImgBoxDiv";
 
// $('nowShowImg').style.visibility = "hidden";

// $('nowShowImg').filters[0].Apply();
// if( $('nowShowImg').style.visibility == "visible" ){
//  $('nowShowImg').style.visibility = "hidden";
//  $('nowShowImg').filters[0].revealTrans.transition=12;
// }
// else
// {
//  $('nowShowImg').style.visibility = "visible";
//  $('nowShowImg').filters[0].transition=12;
// }
// $('nowShowImg').filters[0].Play();
};

function playNext(){
 if( turnId == 4 ){
  turnId = 0;
 }
 else{
  turnId ++;
 }
 nowShow(turnId)
};

function playIt(){
	turnShow = setInterval(playNext,3500);
};
function stopIt(){
	clearInterval(turnShow);
};