	    function replaceString(szString,szFind,szReplace)
		{
		    var iMatched, fSubstring, sSubstring;
		    iMatched=0;
			
			//alert(szString + "/" + szFind + "/" + szReplace);
		
		    while(iMatched>=0)
			{
			        iMatched=szString.indexOf(szFind);
			        if(iMatched<0)
					{					    
				        return szString;
					}
			        fSubstring=szString.substring(0,iMatched);
			        sSubstring=szString.substring(iMatched+szFind.length, szString.length);
			        szString=fSubstring + szReplace + sSubstring;
		    }
		    // Next line for Netscape compatibility 
		    //     only - no effects
			return(0);
		}

		function ConvertURLJS(strURL)
		{

			strTmp="%";
			strURL = replaceString(strURL,"%", "%"+returnBase(strTmp.charCodeAt(0),16));
		
			strURL = replaceString(strURL," ", "%20");		
			
			strTmp="<";
			strURL = replaceString(strURL,"<", "%"+returnBase(strTmp.charCodeAt(0),16));
			
			strTmp=">";
			strURL = replaceString(strURL,">", "%"+returnBase(strTmp.charCodeAt(0),16));
			
			strTmp=")";
			strURL = replaceString(strURL,")", "%"+returnBase(strTmp.charCodeAt(0),16));
			
			strTmp="&";
			strURL = replaceString(strURL,"&", "%"+returnBase(strTmp.charCodeAt(0),16));
			
			strTmp="#";
			strURL = replaceString(strURL,"#", "%"+returnBase(strTmp.charCodeAt(0),16));
			
			strTmp="{";
			strURL = replaceString(strURL,"{", "%"+returnBase(strTmp.charCodeAt(0),16));

			strTmp="}";
			strURL = replaceString(strURL,"}", "%"+returnBase(strTmp.charCodeAt(0),16));
			
			strTmp="+";
			strURL = replaceString(strURL,"+", "%"+returnBase(strTmp.charCodeAt(0),16));
			
			browser7=navigator.appName;
		    if (browser7=="Microsoft Internet Explorer")
			{
				// not allowed in Netscape due to bug :(((
				strTmp="(";
				strURL = replaceString(strURL,"(", "%"+returnBase(strTmp.charCodeAt(0),16));
			}
			return strURL;
		}
		
		
	    function makeArray() 
		{
		    for (i = 0; i<makeArray.arguments.length; i++)
		    this[i] = makeArray.arguments[i];
		}
		
		var convert = new makeArray('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');


	    function returnBase(number,base) 
		{
		    if (number < base) var ouput = convert[number];
	        else 
			{
		        var MSD = '' + Math.floor(number / base);
		        var LSD = number - MSD*base;
		        if (MSD > base) var output = returnBase(MSD,base) + convert[LSD];
		        else var output = convert[MSD] + convert[LSD];
		    }
		    return output;
		}


function openPictureWindow(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	if (imageType == "swf"){
	newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high>');
	newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('</embed></object>');	}else{
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">'); 	}
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function ShowCal(strID, strLID)
{
	OpenWnd("210", "250", "cal.aspx?sid=" + strID + "&lid=" + strLID);
}

function OpenWnd(strWindowWidth, strWindowHeight, strURL, strTitle)
{
	var	strOptions2;
	var w,h;
	strOptions2 = "width=" + strWindowWidth + ", height=" + strWindowHeight;
	strOptions2 = strOptions2 + ",locationbar=no, menubar=no, hotkeys=no, scrollbars=no, resizable=yes";
	
	bDom=document.getElementById?1:0
	bNS4 =(!bDom && document.layers)?1:0;
	
	if (!bNS4)	
		strOptions2 = strOptions2 + ",screenX=" + window.screenX + ",screenY="+window.screenY;
				
	objWnd1 = window.open(strURL, strTitle, strOptions2);	
	objWnd1.focus();
}

function Preview(lid, tid)
{


	strURL = 'Preview.aspx?lid=' + lid + '&tid=' + tid;	
	objWnd2 = window.open(strURL, 'Preview', '');
	objWnd2.focus();

}
