
function createImg() {
	
	//alert("foo");alert(document.assetMgr_mainForm.file_assetFile.value);
	
	var why=""; 
	why+=genericField(document.assetMgr_mainForm.txt_assetName,'&raquo; Please give this image a name!','lbl_txt_assetName'); 
	why+=hasImg();
	
	
	if (why !="") {
		document.getElementById('add_image_error').style.display="block";
		document.getElementById('add_image_error').style.position="relative";
		document.getElementById('add_image_error').style.height="auto";
		document.getElementById('add_image_error').innerHTML="<br />One or more errors occurred that must be corrected:<br />"+why+"<br /><br />";
		window.location="#";
	}
	else {
		document.getElementById('add_image_error').style.display="none";
		document.forms['assetMgr_mainForm'].submit();
	}
	
}

function hasImg() {
var error="";
	if ( (document.getElementById("file_assetFile").value=="") && (document.getElementById("file_assetFile2").value=="") && (document.getElementById("asset_fileName").value=="") ) {
		//alert("Foo");
		error="&raquo; You must choose at least either a High-res or Low-res image.<br />\n";
		setError("lbl_txt_assetFile");
		setError("lbl_txt_assetFile2");
		document.getElementById('lowRes').style.display="block";
	}
	else {
		clearError("lbl_txt_assetFile");
		clearError("lbl_txt_assetFile2");
	}
return error;
}
function genericField(myStrng,myError,myLabel) {
var error="";
var validChars=/[{\}\<\>]/i;
	if (validChars.test(myStrng.value)) {
		error=myError+"<br />\n";
		setError(myLabel);
	}
	else if (myStrng.value=="") {
		error=myError+"<br />\n";
		setError(myLabel);
	}
	else {
		clearError(myLabel)
	}
return error;
}


function setError(el) {
	obj=document.getElementById(el);
	obj.style.color="red";
}
function clearError(el) {
	obj=document.getElementById(el);
	obj.style.color="";
}



function toggleMe(el) {
	obj = document.getElementById(el);
	/*
	if (document.getElementById(obj).style.display=="none") {
		document.getElementById(obj).style.display=="block";
	}
	else {
		document.getElementById(obj).style.display=="none"	
	}
	*/
	obj.style.display = (obj.style.display=="none") ? "block" : "none";
	
	
}

function selectGet(value,page,name) {
	//alert(page);
	window.location=(page)+"?cat="+(value);
}


var xmlHttp

function showCategory(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="./_include/get_type.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 //alert(xmlHttp.responseText);
 document.getElementById("selectUsage").innerHTML=xmlHttp.responseText 
 } 
}

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;
}

var xmlHttp

function showTypeDescrip(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="./_include/get_type_descrip.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged2 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged2() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
 //alert(xmlHttp.responseText);
 	if (document.getElementById("txtA_txtDesc").value=="") {
		document.getElementById("txtA_txtDesc").innerHTML=xmlHttp.responseText;
	}
	else {
		document.getElementById("txtA_txtDesc_hint").innerHTML="<span style='color: red'><strong>Suggested Base Description:</strong> "+xmlHttp.responseText+"</span><br />";	
	}
 } 
}

