function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function getImageName(cString){
// the string includes several slashes. I want the last string
	var nLen;
	aStrings=new Array;
	aStrings=cString.split("/");
	nLen=aStrings.length;
	imageName =aStrings[nLen-1]; //base 0
	return imageName
}

function getImagePath(cString){
// the string includes several slashes. I want the last string
	var nLen;
	aStrings=new Array;
	aStrings=cString.split("/");
	nLen=aStrings.length;	
	imagePath = '';
	if (aStrings[0] != 'images') {
		imagePath = 'images/'		
	}
	for(i=0; i < nLen - 1; i++)
	{
		
		imagePath = imagePath + aStrings[i] + "/";
	}
	return imagePath
}

function openWindow(src,nWidth,nHeight,cMsg){
	var cPict;
	var cWindow;
	var stats;
	var objwin;
	var cButton;
	var cString;
	// get the name of the new picture, from the src remove the sm prefix
	cPict=getImageName(src);	
	imagePath = getImagePath(src);	
	cPict=cPict.substr(2,cPict.length-1)
	// get the .jpg ending
	cWindow=cPict.substr(0,cPict.length-4)	
	// add to width and height so that close button can be seen and no scrollbars appear
	totalWidth = parseInt(nWidth)+ 50;
	totalHeight = parseInt(nHeight) + 100;	
	stats="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,Top=0";
	stats+=",resizable=yes,width="+totalWidth+",height="+totalHeight;	
	objwin=window.open("",cWindow,stats);	
	objwin.document.write("<html>");
	objwin.document.write("<head><title>Legend Surfboards - "+cWindow+"</title></head>");
	objwin.document.write("<body bgcolor='white'>");
	objwin.document.write("<center>");		 
	cString="<img src='"+imagePath+cPict+"'>";
	objwin.document.write(cString);
	objwin.document.write("<br/>");
	objwin.document.write("<br/>");
	objwin.document.write ("<font face=tahoma size=1>"+cMsg+"</font><br/>");
	objwin.document.write("<br/>");
	cButton="<input type='button' value='Close' onClick='window.close()'>"
	objwin.document.write(cButton);
	objwin.document.write("</center>");
	objwin.document.write("</body>");
	objwin.document.write("</html>");
	objwin.document.close();
}


function showCounter()
{
	try
	{
		decounter = document.getElementById('counter')		
		decounter.style.visibility = 'visible'
	}
	catch(e)
	{
		alert(e);
	}
	

}


function hideCounter()
{
	try {		
		decounter = document.getElementById('counter')
		decounter.style.visibility = 'hidden'
	}
	catch(e) {
		alert(e);
	}
}

