
//Global Variables--------------------------------------------------->
	var myWidth = 0;
	var myHeight = 0;
	
	var IE = document.all?true:false
		
	var posX = 0;
	var posY = 0;
	
	var loadState=0;
	
	var currTtp;
	var showTtp=false;
//Global Variables---------------------------------------------------|



//Initialize Variables----------------------------------------------->
	getWH();

//Initialize Variables-----------------------------------------------|


window.onload=function()
{
				
	commonFunctionsAfterLoad();
	
	/*var ht_1=document.getElementById('header').clientHeight;
	var ht_2=document.getElementById('home_body').clientHeight;
	var ht_3=document.getElementById('footer_sp').clientHeight;
	var ht_4=document.getElementById('footer').clientHeight;
	
	var ttl_h=(ht_1+ht_2+ht_3+ht_4);
	if(myHeight>ttl_h)
	document.getElementById('extra_spacing').style.height=(myHeight-ttl_h)+'px';*/
}



window.onresize=function()
{
	
	afterResized();
	
	document.getElementById('extra_spacing').style.height='1px';
	var ht_1=document.getElementById('header').clientHeight;
	var ht_2=document.getElementById('home_body').clientHeight;
	var ht_3=document.getElementById('footer_sp').clientHeight;
	var ht_4=document.getElementById('footer').clientHeight;
	
	var ttl_h=(ht_1+ht_2+ht_3+ht_4);
	if(myHeight>ttl_h)
	document.getElementById('extra_spacing').style.height=(myHeight-ttl_h)+'px';
}



function submitNletter(msg)
{
	document.getElementById('news_letter_msg').style.display='block';
	nleml=document.getElementById('hnletter').value;
	if(isprEmail(nleml))
	{
		getVar='nl_email='+nleml;
		nletterAJX('news_letter_msg','submit_nletter',getVar);
	}
	else document.getElementById('news_letter_msg').innerHTML=msg;
	
	return false;
}

function nletterAJX(loadtoid,pageName,getVar)
{
	
	if(loadtoid!='')document.getElementById(loadtoid).innerHTML='Loading...';
	
	var xmlHttp;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		try
		  {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		catch (e)
		  {
			  alert("Your browser does not support AJAX!");
			  return false;
		  }
		}
	  }
	  xmlHttp.onreadystatechange=function()
		{
		if(xmlHttp.readyState==4)
		  {
			//alert(xmlHttp.responseText);
			if(loadtoid!='')document.getElementById(loadtoid).innerHTML=xmlHttp.responseText;			
		  }
		}
	
	  xmlHttp.open("GET",base_url+"/site/user/php/pbox/"+pageName+".php?"+getVar,true);
	  xmlHttp.send(null);
}


function getDataAJX(loadtoid,pageName,getVar)
{	
	if(loadtoid!='')document.getElementById(loadtoid).innerHTML='Loading...';
	
	var xmlHttp;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		try
		  {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		catch (e)
		  {
			  alert("Your browser does not support AJAX!");
			  return false;
		  }
		}
	  }
	  xmlHttp.onreadystatechange=function()
		{
		if(xmlHttp.readyState==4)
		  {
			//alert(xmlHttp.responseText);
			if(loadtoid!='')document.getElementById(loadtoid).innerHTML=xmlHttp.responseText;
			
		  }
		}
	
	  xmlHttp.open("GET",base_url+"/site/user/php/pbox/"+pageName+".php?"+getVar,true);
	  xmlHttp.send(null);
}


function isprEmail(email)
{
 	if(email.length <= 0)
	{
	  return false;
	}
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
	return false;
}



function playBreakingNews1(dtann)
{
	var roundn=0;
	var roundnn=0;
	var terms=0;
	
	var brkIninterval = setInterval(function() 
	{			
		if(terms==1)
		{
			fadeOut('brknews'+(roundnn),2000);				
			terms=0;			
		}
		else
		{
			fadeIn('brknews'+roundn,100);
			roundnn=roundn;
			roundn++;		
			if(roundn==dtann)
			{
				roundn=0;
				roundnn=dtann-1;
			}
			terms=1;
		}			
	},2000);
	
					
		
}

function playBreakingNews2(dta)
{
	var dta_arr=dta.split('|||');
	var dta_len=dta_arr.length;
	var currnn=1;
	var obj=document.getElementById('brknews');
	
	
		var str=dta_arr[0];
					
		//for(var i=0;i<str.length;i++)
		var ii=0;
		varstrinterval = setInterval(function()
		{
			if(ii==(str.length-1))
			mystr=str.slice(0,(ii+1));
			else
			mystr=str.slice(0,(ii+1))+'_';
			
			obj.innerHTML=mystr;
			ii++;
			if(ii>=str.length)clearInterval(varstrinterval);
		},30);
	
	
	
	var brkinterval = setInterval(function()
	{
		str=dta_arr[currnn];
					
		//for(var i=0;i<str.length;i++)
		var ii=0;
		varstrinterval = setInterval(function()
		{
			if(ii==(str.length-1))
			mystr=str.slice(0,(ii+1));
			else
			mystr=str.slice(0,(ii+1))+'_';
			
			obj.innerHTML=mystr;
			ii++;
			if(ii>=str.length)clearInterval(varstrinterval);
		},30);
		
		currnn++;
		if(currnn==(dta_len-1))currnn=0;
				
	},5000);
	
	
}




function htmlFilter(Word) {
a = Word.indexOf("<");
b = Word.indexOf(">");
len = Word.length;
c = Word.substring(0, a);
if(b == -1)
b = a;
d = Word.substring((b + 1), len);
Word = c + d;
tagCheck = Word.indexOf("<");
if(tagCheck != -1)
Word = htmlFilter(Word);
return Word;
}
