//PSJ Health Center JavaScript document

function checkPDF()
{
	if (document.form_pdfview.pdfview.value != '')
		return true;
	else
		return false;
}

function openWindow(theURL,winName,features, myWidth, myHeight, isCenter, comment) 
		{
			if (window.screen) if (isCenter) if (isCenter=="true")
			{
				var myLeft = (screen.width-myWidth)/2;
				var myTop = (screen.height-myHeight)/2;
				features+=(features!='')?',':'';
				features+=',left='+myLeft+',top='+myTop;
			}
		
			window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
		}
//this fix circumvents the "click to view" hotfix implements for Windows XP and Windows 2003 server users with IE6

function flash_write(file, width, height) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="movie" ><param name="movie" value="'+file+'" /><param name="menu" value="false" /><param name="bgcolor" value="##FFFBF2" /><param name="wmode" value="transparent" /><param name="menu" value="false" /><!--[if !IE]> <--> <object type="application/x-shockwave-flash" data="'+file+'" width="'+width+'" height="'+height+'"><embed src="'+file+'" quality="high" wmode="transparent" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed></object><!--> <![endif]--></object>');
}

// POP-UP DIV HANDLERS

function showPop(imgWidth,imgHeight,path,caption,id) {
	if (!caption) {
		caption = '';
	}		
	if (!id) {
		id = 'popDiv';
	}	
	var popDiv = top.document.getElementById(id);
	var popCaption = top.document.getElementById('popCaption');
	var popScrn = top.document.getElementById('popScrn');
	//var popFrame = top.document.getElementById('popFrame');
	
	var winWidth = document.body.clientWidth;
	var winHeight = document.documentElement.clientHeight;
	var scrHeight = document.documentElement.scrollTop;
	var scrollHeight = document.documentElement.scrollHeight;
	
	//popFrame.style.display = 'block';
	//popFrame.style.height = scrollHeight+'px';
	
	popScrn.style.display = 'block';
	popScrn.style.height = scrollHeight+'px';
	
	popDiv.style.display = 'block';
	popDiv.style.width = imgWidth+'px';
	popDiv.style.height = imgHeight+'px';
	
	document.getElementById('largeImg').src = path;
	
	capWidth = imgWidth + 40; // added width is determined by popDiv padding in stylesheet
	popCaption.style.width = capWidth+'px';
	popCaption.innerHTML = caption;
	
	xPos = (winWidth - imgWidth)/2;
	yPos = (winHeight - imgHeight)/2 + scrHeight;

	popDiv.style.left = xPos+'px';
	popDiv.style.top = yPos+'px';
}

function hidePop(id) {
	if (!id) {
		id = 'popDiv';
	}
	document.getElementById('popScrn').style.display='none';
	document.getElementById(id).style.display = 'none';
	document.getElementById('largeImg').src = '/_media/spacer.gif';
}

function showLarge(imgsrc,imgcap,id) {
	var caption = document.getElementById(imgcap).innerHTML;
	var thumb = document.getElementById(imgsrc);
	var src = thumb.getAttribute('src');
	var imgWidth = ((thumb.width)*3.33);
	var imgHeight = ((thumb.height)*3.33);
	var fileName = src.substring(src.lastIndexOf('/'), src.length);
	var path = 'http://bec.caxiamgroup.net/_media/ax_gallery/large'+fileName;
	//document.getElementById(large).style.backgroundImage = 'url('+path+')';
	showPop(imgWidth,imgHeight,path,caption);
}

// Image Swap Function
function doDetailSwap(newVal, newImage, id)
{
	if (newVal.length)
	{
		var colorSwap = document.getElementById(id);
		colorSwap.src = '/_media/' + newImage + '.jpg';
	}
}


function showME(id) {
	document.getElementById(id).style.display = 'block';
}

function hideME(id) {
	document.getElementById(id).style.display = 'none';
}

function showLarge(imgsrc,imgcap,id) {
	var caption = document.getElementById(imgcap).innerHTML;
	var thumb = document.getElementById(imgsrc);
	var src = thumb.getAttribute('src');
	var imgWidth = ((thumb.width)*3.33);
	var imgHeight = ((thumb.height)*3.33);
	var fileName = src.substring(src.lastIndexOf('/'), src.length);
	var path = 'http://bec.caxiamgroup.net/_media/ax_gallery/large'+fileName;
	//document.getElementById(large).style.backgroundImage = 'url('+path+')';
	showPop(imgWidth,imgHeight,path,caption);
}

// BASIC SHOW/HIDE
function showHide(event,node) {
	event.cancelBubble=true;
	document.getElementById(node).style.display =
		 (document.getElementById(node).style.display == "none")?"":"none";
	event.cancelBubble=true;
}