
	//Curvica Web Site Modules
	//Copyright 2000
	//Created: 5/6/00 :DC
	//Version 1.5
	//Library Function
	//Dropping and Reading Cookies

	function readCookie(zpName){
		zpName=zpName+"=";
		lpLen = zpName.length;
		lpFromN = document.cookie.indexOf(zpName)+0;
	    	if((lpFromN) != -1){
			lpFromN +=lpLen  
		        lpToN=document.cookie.indexOf(";",lpFromN)+0;
		        if(lpToN == -1) 
		          {lpToN=document.cookie.length;} 
	        return unescape(document.cookie.substring(lpFromN,lpToN));
		}
		return null;
	}

	function appendCookie(zpName,zpValue,datTime){
		datExp = new Date();
		if((zpName==null)||(zpValue==null)) return false; 
		if(datTime==null) datTime=365*86400000; 
		datExp.setTime(datExp.getTime()+datTime);
		zpValue=readCookie(zpName)+":"+zpValue;
		document.cookie =escape(zpName)+"="+escape(zpValue)+"; "+"expires="+datExp.toGMTString();
		window.location.reload();
		
	}

	function deleteCookie(zpName){
		datExp = new Date();
		if(zpName==null) return false; 
		document.cookie =escape(zpName)+"="+"; "+"expires="+datExp.toGMTString();
		window.location.href="reload.html";
		
	}

	function getThumbOnButtonState(){
		
		if (readCookie('chartThumbs')==null){
			//no cookie so default to DOWN state
			document.write("<img src=\"images/but_thumbon.gif\" width=49 height=30>");
		}else{
			//has cookie so turn button to UP state
			document.write("<a href=\"javascript:setThumbsON()\">");
			document.write("<img src=\"images/but_thumbon_off.gif\" width=52 height=30 border=0></a>");
		}		
	}
	function getThumbOffButtonState(){
		if (readCookie('chartThumbs')==null){
			//no cookie so default to UP state
			document.write("<a href=\"javascript:setThumbsOFF()\">");
			document.write("<img src=\"images/but_thumboff_off.gif\" width=55 height=30 border=0></a>");
		}else{
			//has cookie so turn button to DOWN state
			document.write("<img src=\"images/but_thumboff.gif\" width=55 height=30>");
		}		
	}

	function setThumbsON(){
		//set cookie
		deleteCookie('chartThumbs');
		//reload page
		reloadPage();
	}

	function setThumbsOFF(){
		//delete cookie
		appendCookie('chartThumbs','ON',null);
		//reload page
		reloadPage();
	}

	function reloadPage(){
		//reloads page with a cache busting time suffix
		var d = new Date();
		var t = escape(d.getTime());
		var zURL = new String(window.location.href).split('&');
		window.location.href=zURL[0] + '?&' + t;
	}

	function showEntity(lpID,zpEntityType,zWebThumbImage){
		if (readCookie('chartThumbs')==null){
			if (zWebThumbImage!=''){
					var zpImageFile = 'resources/webThumbImage/' + zWebThumbImage;
			}else{
					var zpImageFile = 'images/icon_noImage.gif';
			}
		
                      	document.write ('<tr><td width=200 align=center valign=middle>');
		        document.write ('<a href=\"viewerChart' + lpID + '.html\">');
			document.write ('<img src=\"' + zpImageFile + '\" width=200 border=0>');
			document.write ('</a></td>');
		}else{
                      	document.write ('<tr><td width=16 align=right valign=top>');
			document.write ('<a href=\"viewerChart' + lpID + '.html\">');
			document.write ('<img src=\"images/icon_allow' + zpEntityType  + '.gif\" width=15 border=0></a></td>');
                  		          
		}
 
	}
	function showSearchThumb(zpItemLink,zpThumbImage){
		if (readCookie('chartThumbs')==null){
			document.write ('<a href=\"' + zpItemLink + '\"><img src=\"' + zpThumbImage + '\" width=200 border=0></a><br>');
	          
		}
 
	}



	

		