

//Max Window

if (document.all) {
	if((window.screenLeft != 0) && (window.screenTop != 0)){
		top.window.moveTo(0,0);		
		top.window.resizeTo(screen.availWidth,screen.availHeight);
	}
}
else if (document.layers||document.getElementById) {
if((window.screenX > 0) && (window.screenY > 0)){
	top.window.moveTo(0,0);
	if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){	
		top.window.outerHeight = screen.availHeight;
		top.window.outerWidth = screen.availWidth;
	}
}
}


//Scrolling Toolbar
function chaserRollover(imgid,imgsrc)
{
    
	nnstr=(document.layers)?"document.layers.toolbar_menu.":""
	eval(nnstr+"document.images['"+imgid+"'].src='"+imgsrc+"'")
}

function ClassChaser(divName,objName,takeOffTop,takeOffBottom)
{
	
	// note the object is assuming that the magins of the HTML page are set to 0
	//Properties
	this.objName=objName 
	this.name=divName
	this.takeOffTop=(takeOffTop!=null)?parseInt(takeOffTop):0;			//default value to 0 
	this.takeOffBottom=(takeOffBottom!=null)?parseInt(takeOffBottom):0;	//default value to 0 
	this.startPos												//position where the div start chasing from
	this.endPos													//position where the div end chasing in	
	this.styleRef												//refers to div styles according to browsers
	this.divObj													//div object reference
	this.availableScrollingHeight								//available height for the div to scroll in
	this.divHeight												//chaserHeight
	this.callRate = 10
	this.slideTime = 1200
	this.A
	this.B
	this.C
	this.D
	this.interval
	this.initialised
	
	
	//methods
	this.init = m_sw_init;	
	this.findObj = m_sw_findObj;
	this.main =	m_sw_main;
	this.slide = m_sw_slide;
	this.slideInit = m_sw_slideInit;
	this.startChase = m_sw_startChase;
}
function m_sw_init()
{
	
	this.macstr='MacPPC'
	this.ismac = (navigator.platform == this.macstr)
	this.styleRef=(document.layers)?"":".style"
	this.divObj=this.findObj(this.name)
	//position layer
	eval("this.divObj"+this.styleRef+".top=this.takeOffTop")
	this.divHeight=(document.layers)?parseInt(this.divObj.document.height):((document.all)?parseInt(this.divObj.clientHeight):parseInt(this.divObj.offsetHeight))
	this.availableScrollingHeight=((document.all)?((this.ismac)?parseInt(document.body.offsetHeight):parseInt(document.body.scrollHeight)):parseInt(document.height))-this.takeOffTop-this.takeOffBottom-this.divHeight
	this.startPos=this.takeOffTop
	this.endPos=this.availableScrollingHeight+this.takeOffTop;
	this.initialised=true
	if (!document.all)
	{
		eval("this.interval=setInterval(\'"+this.objName+".main()\',this.callRate)");//this.callRate
	}
}

function m_sw_findObj(n,d) { 
	var p,i,x;  
	if(!d) d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) 
	{
	    	d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
	//Case IE
	if(!(x=d[n])&&d.all) 
		x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++) 
		x=d.forms[i][n];
	//Case NN
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
		x=this.findObj(n,d.layers[i].document);
	//Case NN6
	if(!x && d.getElementById) 
		x=d.getElementById(n); 
	return x;
}

function m_sw_main()
{
	eval("this.currentY=parseInt(this.divObj"+this.styleRef+".top)")
	this.scrollTop	= (document.all)?parseInt(document.body.scrollTop):parseInt(window.pageYOffset);
	var newTargetY	= this.scrollTop +(this.startPos)
		
	if ( this.currentY != newTargetY ) {

		if ( newTargetY != this.targetY ) {

			this.targetY = newTargetY
			if (this.availableScrollingHeight>0)
				this.slideInit( )
	
		}
	if (this.availableScrollingHeight>0)
		this.slide( )
		
	}
}

function m_sw_slideInit()
{
	var now	= new Date( )
	this.A		= this.targetY - this.currentY
	this.B		= Math.PI / ( 2 * this.slideTime )
	this.C		= now.getTime( )

	if (Math.abs(this.A) > this.availableScrollingHeight) {
		this.D = this.A > 0 ? this.targetY - this.availableScrollingHeight : this.targetY + this.availableScrollingHeight
		this.A = this.A > 0 ? this.availableScrollingHeight : -this.availableScrollingHeight
	} else {
		this.D = this.currentY
	}
}




function m_sw_slide()
{
	var now	= new Date( )
	var newY	= this.A * Math.sin( this.B * ( now.getTime( ) - this.C ) ) + this.D
	newY		= Math.round( newY )

	if (( (this.A > 0) && (newY > this.currentY) && (newY<=this.endPos)) ||
		( (this.A < 0) && (newY < this.currentY) && (newY<=this.endPos) )) {
			eval("this.divObj"+this.styleRef+".top=newY")
	}
	if ((newY==this.targetY)&& (this.interval)&&(document.all))
	{
		clearInterval(this.interval)
	}
}

function m_sw_startChase()
{
	if ((document.all)&&(this.initialised))
	{
		if (this.interval)
		{	
			clearInterval(this.interval)
		}
		eval("this.interval=setInterval(\'"+this.objName+".main()\',this.callRate)");
	}
}

function SurfTo(PageLocation) {
	window.location.href = PageLocation;
}

	var objPage = Page();
	function Page() {
		return(this);
	}
	objPage.idPage='553';
					
	OChaser= new ClassChaser("toolbar_menu","OChaser",0,0)

	function init()
	{
		OChaser.init();
	}

//Search Validation
function validate_search() {
	if (document.frm_search.txtSearch.value==""){
		alert("Please enter at least one keyword to search");
		return false;
	}
	return true
}	

function toolbar_SaveReadLater(strRegSiteURL)
   {
	var myquerystring='';
	if (document.frmReadLater.user_id.value=='0' || document.frmReadLater.user_id.value=='')
	{
	  myquerystring = "?msg_id=1100&site_id=" + document.frmReadLater.site_id.value + "&display_mode=0&page_access_level=10";
	  window.location.href = strRegSiteURL + "/registration/login.asp" + myquerystring
	  return false;
	  }
	  else
	  {
		document.frmReadLater.read_later_title.value = document.title;
		document.frmReadLater.read_later_url.value = window.location.href;
		document.frmReadLater.submit();
		return false;
	   }
   }

function toolbar_SendEmail()
   {
	document.frmSend.send_url.value = window.location.href;
	document.frmSend.submit();
		
	return false;
   }



function toolbar_ViewReadLater(strRegSiteURL)
{
	var myquerystring='';
	
	if (document.frmReadLater.user_id.value=='0' || document.frmReadLater.user_id.value=='')
	{
	  myquerystring = "?msg_id=1100&site_id=" + document.frmReadLater.site_id.value + "&display_mode=0&page_access_level=10";
	  window.location.href = strRegSiteURL + "/registration/login.asp" + myquerystring
	  return false;
	  }
	  else
	  {
		window.location.href ="/readlater/index.asp"
		return false;
		}
	
}

function findQueryString(strHref)
{
 for(i=0;i<strHref.length;i++)
  {
    if (strHref.charAt(i) == "?")
      return i;
  }
  return -1;
}

function findBokmark(strHref)
{
 for(i=0;i<strHref.length;i++)
  {
    if (strHref.charAt(i) == "#")
      return i;
  }
  return -1;
}


function toolbar_print()
{
	
	var strUrl = window.location.href
	i = findBokmark(strUrl)	
	if (i >0)
		strUrl = strUrl.substr(0,i)
	
	var strQueryString = "";
	var i = findQueryString(strUrl + '');
	if (i >0)
		strQueryString = strUrl.substr(i)

	if(strQueryString.length>0)
	  strUrl =strUrl + "&print=Y"
	else
		strUrl =strUrl + "?print=Y"
		
	print_window = window.open(strUrl,"","width=750,scrollbars=yes")	
	print_window.focus(); 
}

function printPage(strFlag)
{
	if (strFlag == 'Y')
		window.print();

}

function move_to_page(iPage)
{
	//alert(document.frm.page_number.value)
	document.frm.page_number.value = iPage;
	document.frm.submit();
	return false;
}

