﻿function encode(string) 
{
  return escape(_utf8_encode(string));
}
 function decode(string) 
{
  return _utf8_decode(unescape(string));
}

function _utf8_encode(string) 
{
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
}
function _utf8_decode (utftext) 
{
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
 
			c = utftext.charCodeAt(i);
 
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
 
		}
 
		return string;
	}
function SearchNews(url,txtid)
{
   link=url+'Pages/SearchNews.aspx?vl='+encode(document.getElementById(txtid).value);
   window.open(link,'_blank');
}

function  Inmouse(urlimgnews,imgid)
    {
        document.getElementById(imgid).src=urlimgnews;
    }
function ShowSubmenu(dvid)
{
    document.getElementById(dvid).style.visibility="visible";
}
function HiddenSubmenu(dvid)
{
   document.getElementById(dvid).style.visibility="hidden";
}

 function  Inmouse(urlimgnews,imgid)
        {
            document.getElementById(imgid).src=urlimgnews;
        }
      
 function showMap(divid)
 {
   document.getElementById(divid).style.visibility="visible";
 }
 function HiddenMap(divid)
 {
   document.getElementById(divid).style.visibility="hidden";
 }
 function PopupMap(strurl)
 {  
    toleft= window.screen.width/2-150;
    totop=window.screen.height/2-150;
    window.open(strurl,'Popup','height =400,width =350,left='+toleft+',top='+totop);
 }
 function Hovermenu(divid)
 {
    document.getElementById(divid).className="linksubmenuA";
 }
 function Outmenu(divid)
 {
    document.getElementById(divid).className="linksubmenu";
 }
// ------------------------------------------------------------------------------
// Show SERVICE
// ------------------------------------------------------------------------------
function vieRotator()
{
	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);
	var qw_as=document.getElementById(qw_a.ElementID);
	var qw_bf
	var 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);
	var qw_ak=document.getElementById(qw_a.Slides[qw_a.qw_e]);
	var qw_ax=parseInt(qw_c.style.top.replace('px',''));
	var qw_ap=parseInt(qw_c.style.left.replace('px',''));
	var 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)]);
		var 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);
		var qw_bq = qw_ck.cells[0];
		var 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);
	var 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+')';
		var 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);
		var qw_bz=qw_ci(qw_bp)-1;
		var qw_cc=qw_ch(qw_bp)-1;
		var qw_cj=qw_bz+qw_bp.offsetWidth+1;
		var 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 PopupChart(strurl)
{  
    toleft= 10;
    totop=0; 
    settings="width=1183,height=1153,top=" + totop + ",left=" + toleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";
    win=window.open(strurl,'Popup',settings);
    win.focus();   
    //window.open(strurl,'Popup','height =1053,width =1183,left='+toleft+',top='+totop+'scrollbars=yes');
} 

function abs(x)
{
	if(x<0)
		return-x;
	else return x;
}


 function h(divid)
 {
 d=document.getElementById(divid);
 if(d.style.display=="block")
 {
 d.style.display="none";
 }
 else
 {
 d.style.display="block"
 }
 }


