//Window Load Function
window.onload=function window_load()
{
	document.getElementById('news_btn').className='news_btn_active';
}

var findPopupNo;
// Exit Popup window - Starts here
function capturekey(e){ 
var key=(typeof event!='undefined')?window.event.keyCode:e.keyCode; 
//alert('Code: '+key);
if(key==27)
{
	//alert('Exit Popup window');
	close_pop_up();
}
} 
if(navigator.appName!= "Mozilla"){document.onkeyup=capturekey} 
else{document.addEventListener("keypress",capturekey,true);
}
// Exit Popup window - Ends here

//Popup window-----------------------------------------------------------------------------------------------------------------------------------------------------
//For Positioning the News & Events Popup window STARTS here
//The argument "tt_win" is used to display the particular Popup window
function pop_up_window(tt_win)
{
	findPopupNo=tt_win;
	 var browser_option;
	 if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ 					//For Firefox/x.x or Firefox x.x (ignoring remaining digits);
	 var ffversion=new Number(RegExp.$1)
	 if (ffversion>=1)
	 {
		 browser_option=1;														//For Firefox (ALL)	  										
	 }
	
	}
	else
	{
		var find_ie=(document.all)?1:0;
		if(find_ie)
		{
			browser_option=2;													//For IE (ALL)
		}
		else
		{
			browser_option=3;													//Other Browsers (Crome, Safari.... etc)
																				
			var opera = (navigator.userAgent.indexOf("Opera") > -1) ? 1 : 0;	
			if(opera==1)
			{
				browser_option=4;												//For opera
		
			}
			
		}
	}
	 
	var win_width1 = 0;
	var win_height1=0;
	if (self.innerHeight)
	{
			win_height1 = self.innerHeight;
			win_width1 = self.innerWidth;				
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	{
			win_height1 = document.documentElement.clientHeight;
			win_width1 = document.documentElement.clientWidth;
	}
	else if (document.body)
	{
			win_height1 = document.body.clientHeight;
			win_width1 = document.body.clientWidth;
	}
	
	var new_left=0;
	var new_top=0;
	new_left=(win_width1-580)/2;
	new_top=(win_height1-507)/2;
	if(browser_option==1 || browser_option==2)
	{
		new_top=document.documentElement.scrollTop+new_top;				// For IE Firefox 
	}
	else if(browser_option==4)
	{
		new_top=document.body.scrollTop+new_top; 						// For Opera
	}
	else
	{
		new_top=document.body.scrollTop+new_top; 						// For Safari, Crome
		if(new_top==0)
		{
			new_top=112+"px";
		}
	}
	
	if(new_left<0)
	{
		new_left=28+"%";
		document.getElementById('news_events_pop_up').style.left=new_left;
		
	}
	else
	{
		document.getElementById('news_events_pop_up').style.left=new_left+"px";
	}
	
	if(new_top<0)
	{
		
		new_top=30;
		document.getElementById('news_events_pop_up').style.top=new_top+"px";		
	}
	else
	{
		document.getElementById('news_events_pop_up').style.top=new_top+"px";
	}

	//To display the "show_popup" div STARTS here
	var split_id=tt_win.split('w');		
	var window_id=split_id[2];
	document.getElementById('show_popup'+window_id).style.display="block";
	document.getElementById('news_events_pop_up').style.display="block";
	document.getElementById('popup_overlay').style.display="block";
	//To display the "show_popup" div ENDS here
}
//For Positioning the News & Events Popup window ENDS here

//For Close "news_events_pop_up" div STARTS here
function close_pop_up()
{
	var popupNo=findPopupNo.split("window");
	//alert(parseInt(popupNo[1]));
	document.getElementById('popup_overlay').style.display="none";
	document.getElementById('news_events_pop_up').style.display="none";
	document.getElementById('show_popup'+parseInt(popupNo[1])).style.display="none";
}
//For Close  "news_events_pop_up" div ENDS here
//Popup window-----------------------------------------------------------------------------------------------------------------------------------------------------



//For Clear the text field STARTS here
function clearText(field)
{
	if (field.defaultValue == field.value) field.value = '';
	else if (field.value == '') field.value = field.defaultValue;	
}
//For Clear the text field ENDS here

