function changeImage(imageSrc)
{
	document.MainImg.src = imageSrc;
}

function enlargeImage()
{
	var imgSrc = document.images.mainImage.src;
	window.open(imgSrc, 'Image');
}

function changeImage(imagesrc,enhanced,imagecaption)
{
	if(enhanced)
	{
		var mainimagetext = '<img name="mainImage" id="mainimage" src="'+imagesrc+'" style="cursor:pointer; border: 1px solid #000000;" onclick="enlargeImage();">';
		//alert(mainimagetext);
	}else{
		var tempimage = new Image();
		tempimage.src = imagesrc;
		if(tempimage.width > 266){
			var mainimagetext = '<img name="mainImage" id="mainimage" src="'+imagesrc+'" style="cursor:pointer; border: 1px solid #000000;" onclick="enlargeImage();">';
		}else{
			var mainimagetext = '<img name="mainImage" id="mainimage" src="'+imagesrc+'" style="cursor:pointer; border: 1px solid #000000;" onclick="enlargeImage();">';
		}
	}
	document.getElementById('lyrMainImage').innerHTML = mainimagetext;
}


function confirmLink(message)
{
	if(confirm(message))
	{
		return true;
	}
	return false;
}

function PrintThisPage(itemDetail) 
{
   var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
       sOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; 

   var sWinHTML = document.getElementById('contentstart').innerHTML;
   
   var winprint=window.open("","",sOption); 
       winprint.document.open(); 
       winprint.document.write('<html>\n<head>\n');
	   winprint.document.write('<title>'+ itemDetail + '</title>\n');
	   winprint.document.write('<LINK href="../stylesheet/global.css" type="text/css" rel="Stylesheet">\n');
	   winprint.document.write('</head>\n<body>\n');
	   winprint.document.write('<table width="98%" align="center"><tr><td><img src="http://www.agwerks.us/images/printer_header.gif"></td></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr></table>');
	   winprint.document.write('<table width="98%" align="center"><tr><td>'); 
       winprint.document.write(sWinHTML);
	   winprint.document.write('</td></tr></table>'); 
       winprint.document.write('</body>\n</html>'); 
       winprint.document.close(); 
       winprint.focus(); 
}

/***************************************************
 * Function: 	
 * Purpose:
 * Parms:	
 ***************************************************/
function display_image(userfile) 
{
  if (userfile != '')  
  {
		selection = 'file:///' + userfile;
		selectionname = 'Local Preview';
	  	Path = userfile;
	
	  myWindows = window.open("", "Preview",
	"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=400,height=350");
	  myWindows.document.open();
	  myWindows.document.write("<HTML><HEAD>");
	  myWindows.document.write("<TITLE>Preview</TITLE>");
	  myWindows.document.write("</HEAD><BODY BGCOLOR=FFFFFF TEXT=000000>");
	  myWindows.document.write("<FORM><CENTER><B><FONT SIZE=+1>" + selectionname + "</FONT></B><HR>");
	  myWindows.document.write("<IMG HSPACE=0 VSPACE=0 " + "SRC='" + selection + "'>");
	  myWindows.document.write("<HR>" +  Path + "<p><INPUT TYPE='button'"+
	  " VALUE='Close' " + "onClick='window.close()'></FORM>");
	  myWindows.document.write("</CENTER>");
	  myWindows.document.write("</BODY></HTML>");
	  myWindows.document.close();
	  myWindows.focus();	
  }
  else 
  {
  	alert("You must select an Image to Preview");	
  }
 }
 
var win = null;
function popup_open(mypage,myname,w,h,scroll)
{	
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=yes,';
      settings +='status=yes';
  win = window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4)
  {
	  win.window.focus();
  }
}
