
var currentTop=0
var clickCheck=0
var timMoveID=0


window.onscroll=scrollcheck


function go_menu(targ){
	var loc=document.location.toString()
	if(loc.indexOf("?")!=-1){
		var params=loc.split("?")[1]	
	}else{
		var params=""	
	}
	if(params!=""){
		if(targ.split("?").length>1){
			targ=targ+"&"+params	
		}else{
			targ=targ+"?"+params
		}
	}
	
	document.location=pthstr+targ	
}

function timescroll(){
	window.clearInterval(timMoveID)
	timMoveID=0

	scrollcheck()
}
function scrollcheck(){

	if(clickCheck==0){
		if (typeof window.pageYOffset=="undefined"){ //must be ie
			currentTop=document.body.scrollTop
		}else{
			currentTop=window.pageYOffset
	
		}
	}else{

		clickCheck=0
		if (typeof window.pageYOffset=="undefined"){ //must be ie
			document.body.scrollTop=currentTop
		}else{
		
			window.scroll(0,currentTop)
		}

	}

}

function itemClicked(){

	if (typeof window.pageYOffset=="undefined"){ //must be ie
		if(document.body.scrollTop==0){
			clickCheck=0
		}else{
			clickCheck=1
		}
	}else{

		if(window.pageYOffset==0){
		
			clickCheck=0
		}else{
			clickCheck=1
			currentTop=window.pageYOffset
		}
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0 with scroll fix

tp=10
	lft=10
	pos=0
	
	if(typeof window.screenX =="undefined"){
	
		if(typeof window.screenTop !="undefined"){
		
			tp=window.screenTop+10
			lf=window.screenLeft+10
			pos=1
		}
	}else{
	
		tp=window.screenY+10
		lf=window.screenX+10
		pos=1
	}
	
	if(pos==1){
		if(features!=""){
			features=features+",top="+tp+",left="+lf
		}else{
			features=features+"top="+tp+",left="+lf
		}
	}
	
	
	 itemClicked()
  x=window.open(theURL,winName,features);
x.focus()
if (typeof window.pageYOffset!="undefined"){
	timMoveID=setInterval("timescroll()",50)
	}
}

function MM_openBrWindow_nopos(theURL,winName,features) { //v2.0 with scroll fix

	 itemClicked()
  x=window.open(theURL,winName,features);
x.focus()
if (typeof window.pageYOffset!="undefined"){
	timMoveID=setInterval("timescroll()",50)
	}
}

function float_page(thisone){
	
	if(typeof thisone!="undefined"){
		targ=thisone.href
		//if(targ!="javascript:;" && targ!="javascript:;" && targ.substr(0,5)!="http:" && targ.substr(0,4)!="www."){
		if(targ!="javascript:;"){
			thisone.target="floater"
			thisone.href="javascript:;"
			MM_openBrWindow(targ,"floater","status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=726,height=600",1)
			
			thisone.href=targ
			
		}
		
	}
}

function tab_rollon(thisone){
	thisone.className="tab_item_hover"	
}

function tab_rolloff(thisone){
	thisone.className="tab_item"	
}

var last_exp=""
function show_exp(fieldnam,ttl,cnt){
	if(last_exp!=fieldnam){
		last_exp=fieldnam
		ob=document.getElementById(fieldnam+"_helpicon")
		if(typeof ob!="undefined" && !!ob){
	
			popup_panel_holder_ob=document.getElementById("popup_panel_holder")
			popup_pointer_cell_ob=document.getElementById("popup_pointer_cell")
			if(typeof popup_panel_holder_ob!="undefined" && !!popup_panel_holder_ob){
			
				title_ob=document.getElementById("popup_title")
				content_ob=document.getElementById("popup_content")
				
				title_ob.innerHTML=ttl
				content_ob.innerHTML=cnt
				content_ob_height=content_ob.offsetHeight+12
				
				
				xoffset=10
				yoffset=-24
				
				vadjustment=34
				
				newx=findPosX(ob)+xoffset
				newy=findPosY(ob)+yoffset
				
				
			
				if(newy+content_ob_height+vadjustment>document.documentElement.scrollTop+document.documentElement.clientHeight){
					
					diff=(newy+content_ob_height+vadjustment)-(document.documentElement.scrollTop+document.documentElement.clientHeight)
					
					
					if(diff+15>=content_ob_height){
						
						diff=content_ob_height-(19)
						if(diff>content_ob_height){
						
							diff=(diff)-content_ob_height-2
						}
					}
					if(diff<0){
						
						diff=0
					}
					newy=newy-diff
					
				}else{
					diff=0
				}
				
				bottom_nav_ob=document.getElementById("page_navigator2")
		
				if(typeof bottom_nav_ob!="undefined" && !!bottom_nav_ob){
					
					nav_ypos=findPosY(bottom_nav_ob)
					//title_ob.innerHTML=(newy+content_ob_height+vadjustment)+" "+nav_ypos
					if(newy+content_ob_height+vadjustment>nav_ypos){
						//title_ob.innerHTML+="yes"
						diff=(newy+content_ob_height+vadjustment)-(nav_ypos)
						
						
						if(diff+15>=content_ob_height){
							
							diff=content_ob_height-(19)
							if(diff>content_ob_height){
							
								diff=(diff)-content_ob_height-2
							}
						}
						if(diff<0){
							
							diff=0
						}
						newy=newy-diff
					}
				}
				popup_pointer_cell_ob.style.paddingTop=(24+diff)+"px"
				//title_ob.innerHTML+=" "+diff
				popup_panel_holder_ob.style.display="block"
				popup_panel_holder_ob.style.left=newx+"px"
			
				popup_panel_holder_ob.style.top=newy+"px"
			}
		}
	}else{
		close_exp()
	}
	
}
function close_exp(){
	last_exp=""
	popup_panel_holder_ob=document.getElementById("popup_panel_holder")
	if(typeof popup_panel_holder_ob!="undefined" && !!popup_panel_holder_ob){
		popup_panel_holder_ob.style.display="none"
	}
}

//CALLED AFTER A USER HAS LOGGED OUT
function post_log_out_user_action(){
	if(browser.isIE){
		document.execCommand('ClearAuthenticationCache') 
	}
	document.location.reload()
}
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}
