if (top.location != location) {
    top.location.href = document.location.href;
} 
	
/*
 * Set browser's default hompage  
 */ 
function setHomepage()
{
 var home_page = '../www.bangkokpost.com/default.htm';
 
 if (document.all)
    {
        document.body.style.behavior='url(#default#homepage)';
  			document.body.setHomePage(home_page);
    }
    else if (window.sidebar)
    {
    if(window.netscape)
    {
         try
   {  
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
         }  
         catch(e)  
         {  
    alert("this action was aviod by your browser,if you want to enable,please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");  
         }
    } 
    var prefs = Components.classes['_40mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
    prefs.setCharPref('browser.startup.homepage',home_page);
 }
}

/*
 * Get new captcha code, param id is element id of image     
 */ 
function getNewCaptcha(id)
{
    document.getElementById(id).src = 'images/captcha.png@sid=' + Math.random();		
		return false;
}

function cldSentVal(id,fname){
	show_calendar("document."+fname+"."+id,document.getElementById(id).value);
}

function clFrmSdv(){
	document.getElementById('keyword').value='';
	document.getElementById('channel_id').value='';
	document.getElementById('papers_sec_id').value='';
	document.getElementById('oneday').value='';
	document.getElementById('published_start').value='';
	document.getElementById('published_end').value='';
	document.getElementById('label').value='';
}

function clearSentSug(){
	document.getElementById('mail_to').value='';
	document.getElementById('mail_body').value='';
	document.getElementById('mail_from').value='';
	document.getElementById('validate_code').value='';
}

function sentUrl(url){
	window.location =encodeURI(url);
	//alert($url);
}

function todayinfoTab(num){
	if(num==1){
		document.getElementById('a_exchangeRate').className='active';
		document.getElementById('a_petrolPrice').className='';
		
		document.getElementById('slot_exchange').style.display = '';
		document.getElementById('petrol').style.display = 'none';
	}else if(num==2){
		document.getElementById('a_exchangeRate').className='';
		document.getElementById('a_petrolPrice').className='active';
		
		document.getElementById('slot_exchange').style.display = 'none';
		document.getElementById('petrol').style.display = '';
	}
	
}

function fbs_click() {u=location.href;t=document.title;window.open('../www.facebook.com/sharer.php@u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}


function OnChange(dropdown)
{
    var myindex  = dropdown.selectedIndex
    var ContentID = dropdown.options[myindex].value
    var baseURL  = 'entertainment/games/'+ContentID;
    top.location.href = baseURL;
    
    return true;
}


function getHoro(dropdown) 
{
	var myindex  = dropdown.selectedIndex
    var SelValue = dropdown.options[myindex].value
	var url = window.location;
	var urlparts = url+'life/horoscope@sign='+SelValue;
	//alert(urlparts);
	if(SelValue == 0)
	{
		alert("Please Select Your Horoscope");
		exit;
	}
    top.location.href = urlparts;
    
    return true;

}
