function showMap(strURL)
{
	window.open(strURL,"Map","top=50,left=50,height=600,width=800,resizable=1");
}
function charLimit(strField, intLimit)
{
	if(strField.value.length > intLimit)
	{
		alert("This field can only contain "+intLimit+" characters.");
		strField.value = strField.value.substring(0,intLimit);
	}
}
function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

   for(i=0; i<sText.length && IsNumber == true; i++) 
   { 
      Char = sText.charAt(i); 
      if(ValidChars.indexOf(Char) == -1) 
      {
         IsNumber = false;
      }
   }
   
   return IsNumber;
   
}
function trim(stringToTrim)
{
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function showOptionalFields()
{
	document.getElementById('optional-fields').style.display = 'block';
	document.getElementById('optional-show').style.display = 'none';
}
function hideSuccessDiv()
{
	document.getElementById('successDiv').style.display = 'none';
}
function changeDimensions(objField)
{
	//convert " to inches
	while(objField.value.indexOf('"') != -1)
    	{
    	    objField.value = objField.value.replace('"',' in');
    	}
	//convert ' to feet
	while(objField.value.indexOf("'") != -1)
    	{
    	    objField.value = objField.value.replace("'"," ft");
    	}
}	
function showFullImage(strURL, intWidth, intHeight)
{
	params  = 'width='+(intWidth+40);
	params += ', height='+(intHeight+40);
	params += ', top=0, left=0, scrollbars=yes';
	window.open(strURL,"fullsize",params);
}
function addUnitMeasure(strFieldId, strValue)
{
	var intLimit = 25;
	var intCurrentLength = document.getElementById(strFieldId).value.length;
	var intValueLength = strValue.length;
	
	if((intCurrentLength + intValueLength + 1) > intLimit)
	{
		alert("This field can only contain "+intLimit+" characters.");
		document.getElementById(strFieldId).value = document.getElementById(strFieldId).value.substring(0,intLimit);
	}
	else
	{
		document.getElementById(strFieldId).value = document.getElementById(strFieldId).value + " " + strValue + " ";
		document.getElementById(strFieldId).focus();
	}
}
function checkCurrency(objField)
{
	if(objField.value != '') objField.value = input_filterAmt(objField.value, 2, 1);
	if(objField.value == "0.00") objField.value = "";
}
function input_filterAmt (str, dec, bNeg) 
{ // auto-correct input - force numeric data based on params. 
 var cDec = '.'; // decimal point symbol 
 var bDec = false; var val = ""; 
 var strf = ""; var neg = ""; var i = 0; 

 if (str == "") return; 
 parseFloat ("0").toFixed (dec); 
 if (bNeg && str.charAt (i) == '-') { neg = '-'; i++; } 

 for (i; i < str.length; i++) 
 { 
  val = str.charAt (i); 
  if (val == cDec) 
  { 
   if (!bDec) { strf += val; bDec = true; } 
  } 
  else if (val >= '0' && val <= '9') 
   strf += val; 
 } 
 strf = (strf == "" ? 0 : neg + strf); 
 return parseFloat (strf).toFixed (dec); 
} 
function uploadWindow()
{
	var uploadWindow =  window.open("/uploading","upload","top=50,left=50,height=100,width=300,scrollbars=0,resizable=0");
}
function viewMySite(strArtistCode, strPath)
{
	var strURL = "/"+strArtistCode;
		
	//art
	if(strPath == "/admin.art.php")
	{
		strURL = strURL + "/art"
	}
	//about
	else if(strPath == "/admin.about.php")
	{
		strURL = strURL + "/about"
	}
	//schedule
	else if(strPath == "/admin.schedule.php")
	{
		strURL = strURL + "/schedule"
	}
	//blog
	else if(strPath == "/admin.blog.php")
	{
		strURL = strURL + "/blog"
	}
	//links
	else if(strPath == "/admin.links.php")
	{
		strURL = strURL + "/links"
	}
	//details
	else if(strPath == "/admin.details.php")
	{
		var strLocation = String(document.location);
		
		//remove last directory if any
		strLocation = strLocation.replace("/add","")
		strLocation = strLocation.replace("/info","")
		strLocation = strLocation.replace("/thumbnail","")
		strLocation = strLocation.replace("/crop","")
		strLocation = strLocation.replace("/rotate","")
		
		var aLocation = new Array();
		aLocation = strLocation.split("/");
		var intArtId = aLocation[aLocation.length-1];
		strURL = strURL + "/art/"+intArtId+"/preview_art"

	}
	
	window.open(strURL,"preview","height=600,width=800,top=50,left=50,scrollbars=yes,resizable=yes");
}