function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

function AddArtwork() {
		params = 'artist=' + document.getElementById('artist').value + '&title=' + document.getElementById('title').value + '&type=' + document.getElementById('type').value + '&gallery=' + document.getElementById('gallery').value + '&categorie=' + document.getElementById('categorie').value + '&text=' + document.getElementById('text').value + '&askprice=' + document.getElementById('askprice').value + '&sellprice=' + document.getElementById('sellprice').value + '&selldate=' + document.getElementById('selldate').value + '&year=' + document.getElementById('year').value + '&artwork_w=' + document.getElementById('awidth').value + '&artwork_h=' + document.getElementById('aheight').value + '&artwork_d=' + document.getElementById('adepth').value + '&art_name=' + document.getElementById('art_name').value + '&art_fname=' + document.getElementById('art_fname').value + '&art_nationality=' + document.getElementById('art_nationality').value + '&art_born=' + document.getElementById('art_born').value + '&art_died=' + document.getElementById('art_died').value + '&art_text=' + document.getElementById('art_text').value + '&gal_name=' + document.getElementById('gal_name').value + '&gal_location=' + document.getElementById('gal_location').value + '&gal_url=' + document.getElementById('gal_url').value + '&gal_email=' + document.getElementById('gal_email').value + '&gal_text=' + document.getElementById('gal_text').value;
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		 
		var url= "addartwork.script.php?" + params;
		xmlHttp.onreadystatechange=Added 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}
	function Added() 
	{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
		 		window.location = 'http://www.artapa.com/artsubmit.php';

		 //window.location="index.php";
	 }
}



function addNewArtistForm(){
	if(document.getElementById('artist').value=="new"){
		document.getElementById('add_new_artist').style.display = "block";
	}else {
		document.getElementById('add_new_artist').style.display = "none";
	}
	
}
function addNewGalleryForm(){
	if(document.getElementById('gallery').value=="new"){
		document.getElementById('add_new_gallery').style.display = "block";
	}else {
		document.getElementById('add_new_gallery').style.display = "none";
	}
	
}



function addPictureScrpt(){
	if(document.getElementById('picture').value==""){
		alert("Please choose a picture");
	}else{
		document.getElementById('addpicture_frm').submit();
	}
}
