﻿// Hieu ung mouse over
var oldClr;
var oldFontColor;
function CYBERAKT_Rotator(){this.GlobalID='';this.ElementID='';this.ContainerID='';this.AutoStart=true;this.HideEffect=null;this.HideEffectDuration=0;this.Loop=true;this.PauseOnMouseOver=true;this.RotationType='ContentScroll';this.ScrollDirection='up';this.ScrollInterval=10;this.qw_bg=1;this.ShowEffect=null;this.ShowEffectDuration=0;this.SlidePause=2000;this.SmoothScrollSpeed='Medium';this.Slides=new Array();this.Tickers=new Array();this.LeadTickers=new Array();this.qw_e=-1;this.qw_m=0;this.qw_i=0;this.qw_f=0;this.qw_ae=0;this.qw_o=true;this.HasTickers=false;this.qw_cn=null;this.qw_u=false;this.qw_ba=false;this.qw_aj='';};function rcr_Start(qw_a){if(qw_a.RotationType=='SlideShow'){ss_ShowNextSlide(qw_a);}else{qw_bw(qw_a);scroll_ShowNextSlide(qw_a);};};function qw_bs(qw_a){if(!qw_a.qw_u)return null;qw_a.qw_u=false;if(!qw_a.qw_ba){if(qw_a.RotationType=='SlideShow'){qw_cm(qw_a);}else{qw_bv(qw_a);};};};function qw_av(qw_a){if(qw_a.qw_u)return null;qw_a.qw_u=true;window.clearTimeout(qw_a.qw_f);window.clearTimeout(qw_a.qw_ae);if(qw_a.SlidePause==0)window.clearInterval(qw_a.qw_i);if(qw_a.RotationType=='SlideShow'){var qw_c=document.getElementById(qw_a.ContainerID);qw_c.style.visibility='visible';};};function qw_v(qw_a){if(qw_a.qw_e==-1)qw_a.qw_e=0;else if(qw_a.qw_e==qw_a.Slides.length-1){qw_a.qw_e=0;qw_a.qw_o=false;}else qw_a.qw_e++;};function qw_bw(qw_a){var qw_c=document.getElementById(qw_a.ContainerID),qw_as=document.getElementById(qw_a.ElementID),qw_bf,qw_ay;switch(qw_a.ScrollDirection){case'up':qw_bf=parseInt(qw_as.style.height.replace('px',''))+'px';qw_ay='0px';break;case'left':qw_bf='0px';qw_ay=parseInt(qw_as.style.width.replace('px',''))+'px';break;};qw_c.style.top=qw_bf;qw_c.style.left=qw_ay;qw_c.style.visibility='visible';};function qw_bv(qw_a){if(qw_a.qw_i==0){scroll_ShowNextSlide(qw_a);}else if(qw_a.SlidePause==0){var qw_b='scroll_NextSlideToView('+qw_a.GlobalID+')';qw_a.qw_i=window.setInterval(qw_b,qw_a.ScrollInterval);};};function scroll_ShowNextSlide(qw_a){qw_v(qw_a);if(!qw_a.Loop&&!qw_a.qw_o){qw_av(qw_a);return null;};var qw_b='scroll_NextSlideToView('+qw_a.GlobalID+')';qw_a.qw_i=window.setInterval(qw_b,qw_a.ScrollInterval);};function scroll_NextSlideToView(qw_a){var qw_c=document.getElementById(qw_a.ContainerID),qw_ak=document.getElementById(qw_a.Slides[qw_a.qw_e]),qw_ax=parseInt(qw_c.style.top.replace('px','')),qw_ap=parseInt(qw_c.style.left.replace('px','')),qw_w=0,qw_s=0,qw_ad=document.getElementById(qw_a.Slides[qw_q(qw_a)]);if(!(qw_a.qw_o&&qw_a.qw_e==0)){qw_w=qw_ad.offsetHeight;qw_s=qw_ad.offsetWidth;};var qw_az=0;switch(qw_a.ScrollDirection){case'up':if(qw_a.RotationType=='ContentScroll'){qw_ax-=qw_a.qw_bg;}else{qw_az=abs(qw_w+qw_ax)/qw_p(qw_a);if(qw_az<=2)qw_az=1;qw_ax-=qw_az;};break;case'left':if(qw_a.RotationType=='ContentScroll'){qw_ap-=qw_a.qw_bg;}else{qw_az=abs(qw_s+qw_ap)/qw_p(qw_a);if(qw_az<=2)qw_az=1;qw_ap-=qw_az;};break;};qw_c.style.top=qw_ax+'px';qw_c.style.left=qw_ap+'px';if((qw_ax+qw_w==0&&qw_a.ScrollDirection=='up')||(qw_ap+qw_s==0&&qw_a.ScrollDirection=='left')){window.clearInterval(qw_a.qw_i);qw_a.qw_i=0;if(!(qw_a.qw_o&&qw_a.qw_e==0))qw_al(qw_a);if(qw_a.HasTickers){rcr_StartTickerSequence(qw_a);}else{var qw_b='scroll_ShowNextSlide('+qw_a.GlobalID+')';if(!qw_a.qw_u)qw_a.qw_f=window.setTimeout(qw_b,qw_a.SlidePause);};};};function qw_al(qw_a){var qw_c=document.getElementById(qw_a.ContainerID);if(qw_a.ScrollDirection=='up'){var qw_ad=document.getElementById(qw_a.Slides[qw_q(qw_a)]),qw_br=qw_ad.cloneNode(true);qw_c.removeChild(qw_ad);qw_c.style.top='0px';qw_c.appendChild(qw_br);qw_t(qw_a);}else{var qw_ck=document.getElementById(qw_a.ContainerRowID),qw_bq=qw_ck.cells[0],qw_cv=qw_ck.removeChild(qw_bq);qw_c.style.left='0px';var qw_cw=qw_ck.appendChild(qw_cv);qw_t(qw_a);};};function qw_q(qw_a){if(qw_a.qw_e==0)return qw_a.Slides.length-1;else return qw_a.qw_e-1;};function qw_p(qw_a){switch(qw_a.SmoothScrollSpeed){case'Slow':return 8;break;case'Medium':return 6;break;case'Fast':return 4;break;};};function qw_cm(qw_a){if(qw_a.HasTickers&&qw_a.qw_aj=='PlayingShowEffect')return null;if(!qw_a.qw_ba){ss_PlayHideEffect(qw_a);var qw_bb=0;if(qw_a.HideEffect)qw_bb=qw_a.HideEffectDuration;qw_b='ss_ShowNextSlide('+qw_a.GlobalID+')';qw_a.qw_f=window.setTimeout(qw_b,qw_bb);};};function ss_ShowNextSlide(qw_a){if(qw_a.qw_u)return null;qw_v(qw_a);var qw_c=document.getElementById(qw_a.ContainerID),qw_ak=document.getElementById(qw_a.Slides[qw_a.qw_e]);qw_c.innerHTML=qw_ak.innerHTML;qw_ak.innerHTML='';qw_t(qw_a);qw_bd(qw_a);if(qw_a.HasTickers){var qw_b='rcr_StartTickerSequence('+qw_a.GlobalID+')',qw_cr=window.setTimeout(qw_b,qw_a.ShowEffectDuration);}else{var qw_b='ss_DisplaySlide('+qw_a.GlobalID+')';qw_a.qw_f=window.setTimeout(qw_b,qw_a.ShowEffectDuration);};};function ss_DisplaySlide(qw_a){if(qw_a.qw_u)return null;qw_a.qw_aj='DisplayingSlide';window.clearTimeout(qw_a.qw_ae);window.clearTimeout(qw_a.qw_f);if(!qw_a.Loop&&qw_a.qw_e==qw_a.Slides.length-1){qw_av(qw_a);return null;};var qw_b='ss_PlayHideEffect('+qw_a.GlobalID+')';qw_a.qw_ae=window.setTimeout(qw_b,qw_a.SlidePause);var qw_bb=0;if(qw_a.HideEffect)qw_bb+=qw_a.HideEffectDuration;qw_bb+=qw_a.SlidePause;qw_b='ss_ShowNextSlide('+qw_a.GlobalID+')';qw_a.qw_f=window.setTimeout(qw_b,qw_bb);};function qw_bd(qw_a){qw_a.qw_aj='PlayingShowEffect';var qw_c=document.getElementById(qw_a.ContainerID);if(qw_c.filters&&qw_a.ShowEffect){qw_c.style.filter=qw_a.ShowEffect;qw_c.filters[0].apply();};qw_c.style.visibility='visible';if(qw_c.filters&&qw_a.ShowEffect)qw_c.filters[0].play();};function ss_PlayHideEffect(qw_a){qw_a.qw_aj='PlayingHideEffect';var qw_c=document.getElementById(qw_a.ContainerID);if(qw_c.filters&&qw_a.HideEffect){qw_c.style.filter=qw_a.HideEffect;qw_c.filters[0].apply();};var qw_ak=document.getElementById(qw_a.Slides[qw_a.qw_e]);qw_ak.innerHTML=qw_c.innerHTML;qw_c.style.visibility='hidden';if(qw_c.filters&&qw_a.HideEffect)qw_c.filters[0].play();};function rcr_StartTickerSequence(qw_a){qw_a.qw_aj='RunningTickers';qw_a.qw_ba=true;rcr_StartTicker(qw_a.LeadTickers[qw_a.qw_m]);};function rcr_EndTickerSequence(qw_a){qw_a.qw_ba=false;if(!qw_a.qw_u){if(qw_a.RotationType=='SlideShow'){ss_DisplaySlide(qw_a);}else{var qw_b='scroll_ShowNextSlide('+qw_a.GlobalID+')';qw_a.qw_f=window.setTimeout(qw_b,qw_a.SlidePause);};};qw_aq(qw_a);};function qw_aq(qw_a){if(qw_a.qw_m==qw_a.LeadTickers.length-1)qw_a.qw_m=0;else qw_a.qw_m++;};function qw_t(qw_a){if(qw_a.HasTickers)for(var qw_ct=0;qw_ct<qw_a.Tickers.length;qw_ct++)qw_af(qw_a.Tickers[qw_ct],'');};function ie_MsOver(qw_bp,qw_g){if(!qw_bp.contains(event.fromElement)&&qw_g)qw_av(qw_g);};function ie_MsOut(qw_bp,qw_g){if(!qw_bp.contains(event.toElement)&&qw_g)qw_bs(qw_g);};function ns_MsOver(qw_bo,qw_au,qw_g){if(qw_ah(qw_au,qw_bo)&&qw_g)qw_av(qw_g);};function ns_MsOut(qw_bo,qw_au,qw_g){if(!qw_ah(qw_au,qw_bo)&&qw_g)qw_bs(qw_g);};function qw_ah(qw_by,qw_bo){if(qw_by!=null){var qw_bp=document.getElementById(qw_by),qw_bz=qw_ci(qw_bp)-1,qw_cc=qw_ch(qw_bp)-1,qw_cj=qw_bz+qw_bp.offsetWidth+1,qw_cb=qw_cc+qw_bp.offsetHeight+1;if((qw_bo.pageX>qw_bz)&&(qw_bo.pageX<qw_cj)&&(qw_bo.pageY>qw_cc)&&(qw_bo.pageY<qw_cb)){return true;}else{return false;};}else{return false;};};function qw_ci(qw_h){var x=0;do{if(qw_h.style.position=='absolute'){return x+qw_h.offsetLeft;}else{x+=qw_h.offsetLeft;if(qw_h.offsetParent)if(qw_h.offsetParent.tagName=='TABLE')if(parseInt(qw_h.offsetParent.border)>0){x+=1;};};}while((qw_h=qw_h.offsetParent));return x;};function qw_ch(qw_h){var y=0;do{if(qw_h.style.position=='absolute'){return y+qw_h.offsetTop;}else{y+=qw_h.offsetTop;if(qw_h.offsetParent)if(qw_h.offsetParent.tagName=='TABLE')if(parseInt(qw_h.offsetParent.border)>0){y+=1;};};}while((qw_h=qw_h.offsetParent));return y;};function abs(x){if(x<0)return-x;else return x;};

function overchangclr(obj,bgcolor,FontColor)
{	//openPage('http://www.vnn.vn')
	oldClr=obj.style.backgroundColor;
	oldFontColor=obj.style.color;
	obj.style.backgroundColor=bgcolor;	
	obj.style.color=FontColor;
	obj.style.cursor='hand';
	return true;	
}
function outchangclr(obj)
{
	obj.style.backgroundColor=oldClr;
	obj.style.color=oldFontColor;
	return true;	
}
//Mở một web page
function openPage(url,vtarget)
{
var sFeature="width=" + screen.width + ", height=" + screen.height + ", resizable=no, location=no, status=no, scrollbars=yes, top=0, left=0, menubar=no";
window.open(url,vtarget,sFeature);
return true;
}
function openPageExt(url,vheight,vwidth,vtarget,vscroll)
{
var sFeature="width=" + vwidth + ", height=" + vheight + ", top=" + (screen.height-vheight)/2 + ", left=" + (screen.width-vwidth)/2 +  ", resizable=no, location=no, status=no, scrollbars=" + vscroll + ",menubar=no";
//alert(sFeature);
window.open(url,vtarget,sFeature);
return true;
}
//Mở một web dialog page
function openDialog(url,agmSend,closewindow)
{
var sFeature="dialogHeight: 630px; dialogWidth: 760px; edge: Sunken; center: Yes; help: No; resizable: No; status: No;";
window.showModalDialog(url,agmSend,sFeature);
if (closewindow)
	{
		window.close();
		}
return true;
}
function openDialogExt(url,agmSend,height,width)
{
var sFeature="dialogHeight: " + height +  "px; dialogWidth: " + width +  "px; edge: Sunken; center: Yes; help: No; resizable: No; status: No;";
window.showModalDialog(url,agmSend,sFeature);
return true;
}
//--------------------------------
//Đóng một cửa sổ S_alert là thông báo đóng cửa sổ, direcClose là đóng trực tiếp hay đóng gián tiếp(có hỏi xem có đóng thật không)
function CloseWindow(S_alert,direcClose)
{
if (direcClose)
{
alert(S_alert);
window.close();
return true;
}
if (S_alert.length!='')
{
	var bConfirm=window.confirm(S_alert);	
	if (bConfirm)
	   {
		window.close();
		}		
}
else
	{
	window.close();
	}
return true;
}
//-------------------------------------
// Dong ho dien tu
var timerID = null;
var timerRunning = false;
var id,pause=0,position=0;

function stopclock (){
        if(timerRunning)
                clearTimeout(timerID);
        timerRunning = false;
}

function showtime () {
        var now = new Date();
        var hours = now.getHours();
        var minutes = now.getMinutes();
        var seconds = now.getSeconds()
        var timeValue = "" + ((hours >12) ? hours -12 :hours)
        timeValue += ((minutes < 10) ? ":0" : ":") + minutes
        timeValue += ((seconds < 10) ? ":0" : ":") + seconds
        timeValue += (hours >= 12) ? " PM" : " AM"
        document.clock.face.value =timeValue;
        timerID = setTimeout("showtime()",1000);
        timerRunning = true;
}
function startclock () {
        stopclock();
        showtime();
}
//------------------------------------ dong ho dien tu

/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

var offsetfrommouse=[15,25]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=0; //duration in seconds image should remain visible. 0 for always.

var defaultimageheight = 40;	// maximum image size.
var defaultimagewidth = 40;	// maximum image size.

var timer;

var t_id = setInterval(animate,20);
var pos=0;
var dir=2;
var len=0;

function animate()
{
var elem = document.getElementById('progress');
if(elem != null) {
if (pos==0) len += dir;
if (len>32 || pos>79) pos += dir;
if (pos>79) len -= dir;
if (pos>79 && len==0) pos=0;
elem.style.left = pos;
elem.style.width = len;
}
}

function remove_loading() {
this.clearInterval(t_id);
var targelem = document.getElementById('loader_container');
targelem.style.display='none';
targelem.style.visibility='hidden';
var t_id = setInterval(animate,60);
}


function gettrailobj(){
if (document.getElementById)
return document.getElementById("preview_div").style
}

function gettrailobjnostyle(){
if (document.getElementById)
return document.getElementById("preview_div")
}

function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function hidetrail(){	
	gettrailobj().display= "none";
	document.onmousemove=""
	gettrailobj().left="-500px"
	clearTimeout(timer);
}

function showtrail(imagename,title,width,height){
	i = imagename
	t = title
	w = width
	h = height
	timer = setTimeout("show('"+i+"',t,w,h);",200);
}

function show(imagename,title,width,height){
 
  var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth - offsetfrommouse[0]
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if( (navigator.userAgent.indexOf("Konqueror")==-1  || navigator.userAgent.indexOf("Firefox")!=-1 || (navigator.userAgent.indexOf("Opera")==-1 && navigator.appVersion.indexOf("MSIE")!=-1)) && (docwidth>650 && docheight>500)) {
		( width == 0 ) ? width = defaultimagewidth: '';
		( height == 0 ) ? height = defaultimageheight: '';
			
		width+=30
		height+=55
		defaultimageheight = height
		defaultimagewidth = width
	
		document.onmousemove=followmouse; 

		//style="width:'+  width +'px;height:'+ height +'px"
		
		newHTML = '<div class="border_preview" style="width:'+  width +'px;"><div id="loader_container"><div id="loader"><div align="center">Loading photo...</div><div id="loader_bg"><div id="progress"></div></div></div></div>';
		newHTML = newHTML + '<p class="title_h2">' + title + '</p>'
		
    newHTML = newHTML + '<div class="preview_temp_load"><img onload="javascript:remove_loading();" src="' + imagename + '" border="0"><span style="height: 200px; width: 0px; display: inline-block;"></span></div>';
		newHTML = newHTML + '</div>'; 
		
		//alert(newHTML);
		
		if(navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")==-1 ){
			//newHTML = newHTML+'<iframe src="about:blank" scrolling="no" frameborder="0"></iframe>';
			// width="'+width+'" height="'+height+'"
		}		

		gettrailobjnostyle().innerHTML = newHTML;
		gettrailobj().display="block";
		
	}
}

function followmouse(e){

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if (typeof e != "undefined"){
		if (docwidth - e.pageX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = e.pageX - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < defaultimageheight + 2*offsetfrommouse[1]){
			ycoord += e.pageY - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (defaultimageheight + 2*offsetfrommouse[1])){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}

	gettrailobj().left=(xcoord)+"px"
	gettrailobj().top=(ycoord)+"px"
}
