
function toggle() {
	var ele = document.getElementById("toggleText");
	var text = document.getElementById("displayText");
	if(ele.style.display == "block") {
		ele.style.display = "none";
		text.innerHTML = "read more...";
	}
	else {
		ele.style.display = "block";
		text.innerHTML = "hide";
	}
} 


function showSalePrice(sale)
{  
  if(sale=="true" || sale=="True"){
		document.getElementById("salePriceDiv").style.display = "";
  }
  else{
	  document.getElementById("salePriceDiv").style.display = "none";
  }
}

function updateViewCount(paintingId)
{  
  //alert("here");
  try
  {    // Firefox, Opera 8.0+, Safari    
  	xmlHttp=new XMLHttpRequest();    
  }
  catch (e)
  {    // Internet Explorer    
  
	  try
	  {      
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
	  }
	  catch (e) 
	  {      
		try
		{        
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
		}
		catch (e)
		{        
			alert("Your browser does not support AJAX!");        
			return false;        
		}      
	  }    
   }  

  xmlHttp.open("GET","ajaxUpdateViewCount.asp?id=" + paintingId + "&time=" + new Date().getTime(),true);
  xmlHttp.send(null);
	return true;
}

function openNewWindow(paintingId)
{
	window.open ("printPainting.asp?paintingId="+paintingId,"mywindow","resizable=1,width=650,height=520");
}


function openNewArtistWindow(artistId)
{
	window.open ("printArtist.asp?artistId="+artistId,"mywindow","resizable=1,width=720,height=520");
}

function addToMailingList(){
	
	  try
	  {    // Firefox, Opera 8.0+, Safari    
		xmlHttp=new XMLHttpRequest();    
	  }
	  catch (e)
	  {    // Internet Explorer    
	  
		  try
		  {      
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
		  }
		  catch (e) 
		  {      
			try
			{        
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			}
			catch (e)
			{        
				alert("Your browser does not support AJAX!");        
				return false;        
			}      
		  }    
	   }  
	   
		xmlHttp.onreadystatechange = function(){
			
			if(xmlHttp.readyState == 4){
				var ajaxDisplay = document.getElementById('ajaxDiv');
				ajaxDisplay.innerHTML = xmlHttp.responseText;
			}
		}
		
		var name = document.getElementById('mailinglistname').value;
		var email = document.getElementById('mailinglistemail').value;
		//alert(name)
		var queryString = "?name=" + encodeURIComponent(name) + "&email=" + email;
		xmlHttp.open("GET", "MailingListHandler.asp" + queryString, true);
		xmlHttp.send(null); 
}


