// Advances in Rheumatology shared scripts file
b = (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) ||
     ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )))
		
imgname = new Array('index','issues','cases','about','smartbot','smart','register','search','slideshows');
var currPage;

function loadem(){
	if (b){
		for(i=0; i < imgname.length; i++){ 
			eval(imgname[i]+"over = new Image();");
			eval(imgname[i]+"over.src = \"images/nav/"+imgname[i]+"_f2.gif\";");
			eval(imgname[i]+"out = new Image();");
			eval(imgname[i]+"out.src = \"images/nav/"+imgname[i]+".gif\";");
		}
	}
}

function imgover(theimagename){
	if (b){
		eval("document."+theimagename+".src= "+theimagename+"over.src;");
	}
}

function imgout(theimagename){
	if (b && theimagename!=currPage){
		eval("document."+theimagename+".src= "+theimagename+"out.src;");
	}
}


function changem(theimagename){
	for (i=0; i<imgname.length;i++){
		eval("document."+imgname[i]+".src= "+imgname[i]+"out.src;");
	}
	currPage = theimagename;
	imgover(theimagename);
}




var theFileSrc
var theFileName
var theTitle
var strScroll
var wid,hei,imgwid,imghei = 0
var ScreenWidth = screen.availWidth; 
var ScreenHeight = screen.availHeight;
var bolDonepopup;
var bolRecent = false;

function openImage(filename,oldwid,oldhei,title){
	//theTitle = title;
	if(filename==theFileName){
		bolRecent = true;
	}
	theFileName = filename;
	if((navigator.userAgent.indexOf('Mac') != -1) && (navigator.userAgent.indexOf('IE') != -1)){
		theImage = document.createElement('IMG');
	}else{
		theImage = new Image();
	}
	
	theImage.src = "images/"+theFileName;
	if(bolRecent){
		openImage2();
	}else{
		theImage.onload = openImage2;
	}
}
	
function openImage2(){
	
	imgwid = theImage.width;
	imghei = theImage.height;
	wid = imgwid;
	hei = imghei;
	var xPos = (ScreenWidth - wid) / 2;
	var yPos = (ScreenHeight - hei) / 2;
	
	if((ScreenWidth < imgwid) || (ScreenHeight < imghei)){
		strScroll = "yes";
	}else{
		strScroll = "no";
	}
	if(ScreenWidth < imgwid){
		wid = ScreenWidth;
	}
	if(ScreenHeight < imghei){
		hei = ScreenHeight-30;
		wid = wid + 16;
		yPos = 0;
		//alert("hi");
	}
	
	newWindow = window.open('','newWindow', 'toolbar=0,location=0,directories=0,status=0,menubar=0,width='+wid+',height='+hei+',top='+yPos+',left='+xPos+',scrollbars='+strScroll);
	with(newWindow.document){
		open();
		write("<html><head><title>"+document.title+"</title></head><body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\"><a href=\"#\" onclick=\"javascript:window.close()\"><img src=\""+theImage.src+"\" border=\"0\"></a></body></html>")
		close();
	}
	newWindow.focus();
	theImage = null;
	wid,hei,imgwid,imghei = 0;
}

function setNav(theNav){
	strNavType = theNav;
}

function getPosition()
{
	var pagename=window.location.href;
	//alert(pagename.indexOf("register.aspx"));
	if (pagename.indexOf("register.aspx")>=0){
	document.forms[0].hid.value=document.body.scrollTop;
	}
}

function setPosition()
{
var pagename=window.location.href;
if (pagename.indexOf("register.aspx")>=0){
	document.body.scrollTop=document.forms[0].hid.value;
	}

}

function OpenWindow(url)
{	
	window.open(url, "window", "scrollbars=yes, status=yes, resizable=yes, toolbar=no,location=no,height=800,width=950");
}
