﻿// JavaScript Document
var MiniSite = new Object();
var topLeft;
topLeft="topLeft";

/*document.body.clientWidth ==> BODY对象宽度
document.body.clientHeight ==> BODY对象高度
document.documentElement.clientWidth ==> 可见区域宽度
document.documentElement.clientHeight ==> 可见区域高度
FireFox中：
document.body.clientWidth ==> BODY对象宽度
document.body.clientHeight ==> BODY对象高度
document.documentElement.clientWidth ==> 可见区域宽度
document.documentElement.clientHeight ==> 可见区域高度

Opera中： 
document.body.clientWidth ==> 可见区域宽度
document.body.clientHeight ==> 可见区域高度
document.documentElement.clientWidth ==> 页面对象宽度（即BODY对象宽度加上Margin宽）
document.documentElement.clientHeight ==> 页面对象高度（即BODY对象高度加上Margin高）*/

MiniSite.Browser = {
	ie: /msie/.test(window.navigator.userAgent.toLowerCase()),
	moz: /gecko/.test(window.navigator.userAgent.toLowerCase()),
	opera: /opera/.test(window.navigator.userAgent.toLowerCase())
};


				
MiniSite.css={
            topLeft: { top: 'http://www.flashh.net/imgs/tt-topLeft-tail.png', middle: 'http://www.flashh.net/imgs/tt-middle-all.png', bottom: 'http://www.flashh.net/imgs/tt-bottom-notail.png' },
            topRight: { top: 'http://www.flashh.net/imgs/tt-topRight-tail.png', middle: 'http://www.flashh.net/imgs/tt-middle-all.png', bottom: 'http://www.flashh.net/imgs/tt-bottom-notail.png' },
            bottomLeft: { top: 'http://www.flashh.net/imgs/tt-top-notail.png', middle: 'http://www.flashh.net/imgs/tt-middle-all.png', bottom: 'http://www.flashh.net/imgs/tt-bottomLeft-tail.png' },
            bottomRight: { top: 'http://www.flashh.net/imgs/tt-top-notail.png', middle: 'http://www.flashh.net/imgs/tt-middle-all.png', bottom: 'http://www.flashh.net/imgs/tt-bottomRight-tail.png' }
}

function getDiv(layer)
{
   var rootid = document.getElementById(layer);
   var tag = rootid.getElementsByTagName("div"); 
   var len = tag.length;
   for(var i = 0; i < len; i++)
   {
     if (tag[i].className == "top"){
	  tag[i].style.background="url("+MiniSite.css[topLeft].top+") no-repeat";
	  tag[i].style.width="199px";
	  if(topLeft=="bottomLeft" || topLeft=="bottomRight")
	     tag[i].style.height="10px";
	  else
	      tag[i].style.height="19px";
	  }
	  if (tag[i].className == "bottom"){
	  tag[i].style.background="url("+MiniSite.css[topLeft].bottom+") no-repeat";
	  tag[i].style.width="199px";
	  if(topLeft=="topLeft" || topLeft=="topRight")
	     tag[i].style.height="10px";
	  else
	      tag[i].style.height="19px";
	  }
   }
}


function getStyleI(layer){
	if(document.getElementById){
		return document.getElementById(layer).style;
	}
	else
	if(document.all){return document.all[layer].style;}
	else{return document[layer];}
}

if(!MiniSite.Browser.ie)
   document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=getMouseXYI;
var mousepositionX=0;
var mousepositionY=0;
var o;
var allowHide=true;
function getMouseXYI(e){

	if(MiniSite.Browser.ie){
		mousepositionX=event.clientX+document.body.scrollLeft;
		mousepositionY=event.clientY+document.documentElement.scrollTop;
		o=event.srcElement;
	}
	else{
		mousepositionX=e.pageX;
		mousepositionY=e.pageY;
		o=e.target;
	}
	if(mousepositionX<0){mousepositionX=0;}
	if(mousepositionY<0){mousepositionY=0;}
	return true;
}
function vw_ge()
{
	var oRet=[];
	var sid="";
	var i=0;
	for(i=0;i<arguments.length;i++)
	{
		sid=arguments[i];
		if("object"==typeof(sid)){oRet.push(sid);}
		else if("string"==typeof(sid)){oRet.push(document.getElementById(sid));}
		if(1==arguments.length){return oRet.length?oRet[0]:null;}
	}
	return oRet;
}
function $t(){return vw_ge.apply(this,arguments);}
function vw_gide(sTagName,sIdSearch,oNode)
{
	var oRet=[];
	try
	{
		var obj=oNode?$t(oNode):document;
		var arr=obj.getElementsByTagName(sTagName);
		var i=0;
		for(i=0;i<arr.length;i++){
		if(sIdSearch&&sIdSearch.length)
			{if(arr[i].id&&-1!=arr[i].id.indexOf(sIdSearch)){oRet.push(arr[i]);}}
		else
			{oRet.push(arr[i]);}
		}
	}
	catch(err){VW.debug(err,"error in vw_gide : "+err.description);}
	return oRet;
}
function showtitle()
{
	var a=vw_gide("a");
	for(var i=0;i<a.length;i++)
	{
		if(a[i].getAttribute("img"))
		{
			/*a[i].onmouseover=function (){showThumb(this);}
			a[i].onmouseout=function (){hideThumb();}*/
		}else
		{
				
			if(a[i].parentNode&&!a[i].onmouseover&&((a[i].alt!=null && a[i].alt!="") ||(a[i].title!=null  &&  a[i].title!="")))
			{

				a[i].onmousemove=function (){
					var aArr = this.getElementsByTagName("a");
					//show(aArr[0].title);
					show(this.title);
					}
				a[i].onmouseout=function (){showHiden();}
			}
		}
	}
}


function $(layer)
{
   if(document.getElementById){
		return document.getElementById(layer);
	}
	else
	if(document.all){return document.all[layer];}
	else{return document[layer];}
}
function positionLayerI(layername,x,y,extra){
	n=getStyleI(layername);
	var TempWidth,TempHeight;
    if(MiniSite.Browser.opera)
    {
	   TempHeight= document.documentElement.clientHeight;
	   TempWidth=document.documentElement.clientWidth;
     }
     else
    {
	   TempHeight= document.documentElement.clientHeight;
	   TempWidth= document.documentElement.clientWidth;
    }
	var extraPosition=extra||false;
	if(extraPosition!=false){
		//$("ntooltip").innerHTML="$(layername).offsetHeight=" +$(layername).offsetHeight+" TempHeight="+TempHeight+" y+$(layername).offsetHeight="+(y+$(layername).offsetHeight)+"x="+x+" y="+y+" topLeft="+topLeft;
	    if(x+extra.imgWidth>TempWidth &&x>extra.imgWidth)
		{
		   topLeft="topRight";
		   x=x-extra.imgWidth-5;
		 }
		 else
		 {
		    topLeft="topLeft";
			x=x+5;
		 }

		if((y+$(layername).offsetHeight)>TempHeight &&  y>$(layername).offsetHeight){
		   if(topLeft=="topRight"){
		       topLeft="bottomRight";
			   y=y-$(layername).offsetHeight-20;
			}
			else
		   {
		     topLeft="bottomLeft";
			 y=y-$(layername).offsetHeight-20;
		   }
		}
		
	//	$("ntooltip").innerHTML="$(layername).offsetHeight=" +$(layername).offsetHeight+" TempHeight="+TempHeight+" y+$(layername).offsetHeight="+(y+$(layername).offsetHeight)+" y="+y+" topLeft="+topLeft;
	//$("ntooltip").innerHTML=$("ntooltip").innerHTML+"$(layername).offsetHeight=" +$(layername).offsetHeight+" TempHeight="+TempHeight+" y+$(layername).offsetHeight="+(y+$(layername).offsetHeight)+"x="+x+" y="+y+" topLeft="+topLeft+" document.documentElement.scrollTop="+document.documentElement.scrollTop;
	}
	n.left=x+'px';
	n.top=y+'px';
	
}
function show(t)
{

	if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};    
  if(o.title!=null  &&  o.title!=""){o.dypop=o.title;o.title=""};
  getStyleI('ShowInfoBox').display='block';
  $("ntooltip").innerHTML= t;
   positionLayerI('ShowInfoBox',mousepositionX,mousepositionY+15,{imgWidth:199,imgHeight:90,moveX:35,moveY:15});
   getDiv('ShowInfoBox');
}
function showHiden()
{
  getStyleI('ShowInfoBox').display='none';
}

showtitle();