function check()
{

			var at="'";
			var v=0;
			var len=document.theForm.field_myalbum_title.value.length;
			str=document.theForm.field_myalbum_title.value;
						
	
	
			for(var i=0;i < len;i++)
			{
				if(str.indexOf(at)==i)
				{
					v=1;
				}
			}				
			if(v==1)
			{	
				alert(" Error !! \n Enter proper title !! \n");
				document.theForm.field_myalbum_title.value="";
				document.theForm.field_myalbum_title.focus();
				return false;
			}
			if (document.theForm.field_myalbum_title.value == "")
			{
				alert(" Error !! \n You must enter a Title!");
				document.theForm.field_myalbum_title.focus();
				return false;
			}
			if (document.theForm.field_myalbum_title.value == "")
			{
				alert(" Error !! \n You must enter a Title!");
				document.theForm.field_myalbum_title.focus();
				return false;
			}
	
			if (document.theForm.field_myalbum_descr.value == "")
			{
				alert(" Error !! \n You must enter a Discription!");
				document.theForm.field_myalbum_descr.focus();
				return false;
			}
			
		
			
			if (document.theForm.field_myalbum_keywords.value == "")
			{
				alert(" Error !! \n You must enter a Tags!");
				document.theForm.field_myalbum_keywords.focus();
				return false;
			}
		
		
		
		
			if(document.theForm.field_myalbum_keywords.value != "")
			{
				//theForm.field_myalbum_keywords.value
				//alert("here");
				
				
				var arr_tag=document.theForm.field_myalbum_keywords.value.split(" ");
				var i;
				
				//alert(arr_tag.length);
				for(i=0;i<arr_tag.length;i++)			
				{
					
					
					if(arr_tag[i].length>14)
					{
						alert(" Error !! \n Too much characters a Tags!"+arr_tag[i]);
						document.theForm.field_myalbum_keywords.focus();
						return false;						
					}
				}
				
			}
			
		//alert ("5");
			
		
		var c=0;
		for(var i=0;i < document.theForm["field_myalbum_categories"].length;i++)
		{
			if(document.theForm["field_myalbum_categories"][i].checked == true)
			{
				c++;
			}
		}
		if(c==0)
		{	
			alert(" Error !! \n Select a Category !! \n");
			return false;
		}
		var l=0;
		for(var i=0;i < document.theForm["field_myalbum_categories"].length;i++)
		{
			if(document.theForm["field_myalbum_categories"][i].checked == true)
			{
				l++;
			}
		}
		if(l==0)
		{	
			alert(" Error !! \n Select a Location !! \n");
			return false;
		}
		
		var l=0;
		for(var i=0;i < document.theForm["field_myalbum_location"].length;i++)
		{
			if(document.theForm["field_myalbum_location"][i].checked == true)
			{
				l++;
			}
		}
		if(l==0)
		{	
			alert(" Error !! \n Select Atleast One Location !! \n");
			return false;
		}		
		
		var checked = document.getElementById("vessle").checked;  				
		//alert (checked);
		
		if(checked && document.getElementById("vessle").value == 'vessle')
		{
			//alert('inner');
			/*if (document.theForm.sp_price.value == "")
			{
				alert(" Error !! \n You must enter a Sale!");
				document.theForm.sp_price.focus();
				return false;
			}*/
			if (document.theForm.sp_price.value == "" && document.theForm.sp_charter.value == "")
			{
				alert(" Error !! \n You must enter a Sale! Or Charter(Weekly)");
				document.theForm.sp_price.focus();
				return false;
			}
			/*if (document.theForm.sp_charter.value == "")
			{
				alert(" Error !! \n You must enter a Charter(Weekly) !");
				document.theForm.sp_charter.focus();
				return false;
			}*/
			if (document.theForm.sp_type.value == "")
			{
				alert(" Error !! \n Select Atleast One Type !");
				document.theForm.sp_type.focus();
				return false;
			}
			if (document.theForm.sp_itemname.value == "")
			{
				alert(" Error !! \n You must enter a Name !");
				document.theForm.sp_itemname.focus();
				return false;
			}
			if (document.theForm.sp_location.value == "")
			{
				alert(" Error !! \n You must enter a Location !");
				document.theForm.sp_location.focus();
				return false;
			}
			if (document.theForm.sp_year.value == "")
			{
				alert(" Error !! \n You must enter a Year !");
				document.theForm.sp_year.focus();
				return false;
			}
			if (document.theForm.sp_builder.value == "")
			{
				alert(" Error !! \n You must enter a Builder !");
				document.theForm.sp_builder.focus();
				return false;
			}
			if (document.theForm.sp_designer.value == "")
			{
				alert(" Error !! \n You must enter a Designer !");
				document.theForm.sp_designer.focus();
				return false;
			}
			if (document.theForm.sp_hull.value == "")
			{
				alert(" Error !! \n You must enter a Hull Material !");
				document.theForm.sp_hull.focus();
				return false;
			}
			if (document.theForm.sp_loa.value == "")
			{
				alert(" Error !! \n You must enter a LOA !");
				document.theForm.sp_loa.focus();
				return false;
			}
			if (document.theForm.sp_beam.value == "")
			{
				alert(" Error !! \n You must enter a Beam !");
				document.theForm.sp_beam.focus();
				return false;
			}
			if (document.theForm.sp_draft.value == "")
			{
				alert(" Error !! \n You must enter a Draft !");
				document.theForm.sp_draft.focus();
				return false;
			}
			if (document.theForm.sp_displacement.value == "")
			{
				alert(" Error !! \n You must enter a Displacement !");
				document.theForm.sp_displacement.focus();
				return false;
			}
			if (document.theForm.sp_main.value == "")
			{
				alert(" Error !! \n You must enter a Hull Material !");
				document.theForm.sp_main.focus();
				return false;
			}
			if (document.theForm.sp_hull.value == "")
			{
				alert(" Error !! \n You must enter a Main !");
				document.theForm.sp_hull.focus();
				return false;
			}if (document.theForm.sp_mainkwhp.value == "")
			{
				alert(" Error !! \n You must enter a Main !");
				document.theForm.sp_mainkwhp.focus();
				return false;
			}
			/*
			if (document.theForm.sp_mainkw.value == "" && )
			{
				alert(" Error !! \n You must Checked a Main KW/HP !");
				document.theForm.sp_mainkw.focus();
				return false;
			}
			*/
			if (document.theForm.sp_aux.value == "")
			{
				alert(" Error !! \n You must enter a Auxilary !");
				document.theForm.sp_aux.focus();
				return false;
			}
			if (document.theForm.sp_auxkwhp.value == "")
			{
				alert(" Error !! \n You must enter a Sub Auxilary !");
				document.theForm.sp_auxkwhp.focus();
				return false;
			}
			if (document.theForm.sp_speedcruise.value == "")
			{
				alert(" Error !! \n You must enter a Cruise Speed !");
				document.theForm.sp_speedcruise.focus();
				return false;
			}
			if (document.theForm.sp_speedmax.value == "")
			{
				alert(" Error !! \n You must enter a Maximum Speed !");
				document.theForm.sp_speedmax.focus();
				return false;
			}
			if (document.theForm.sp_range.value == "")
			{
				alert(" Error !! \n You must enter a Range !");
				document.theForm.sp_range.focus();
				return false;
			}
			if (document.theForm.sp_fuel.value == "")
			{
				alert(" Error !! \n You must enter a Fuel !");
				document.theForm.sp_fuel.focus();
				return false;
			}
			if (document.theForm.sp_water.value == "")
			{
				alert(" Error !! \n You must enter a Water !");
				document.theForm.sp_water.focus();
				return false;
			}
			/*
			*/
			if (document.theForm.sp_holding.value == "")
			{
				alert(" Error !! \n You must enter a Holding !");
				document.theForm.sp_holding.focus();
				return false;
			}
			if (document.theForm.sp_acccrew.value == "")
			{
				alert(" Error !! \n You must enter a Crew !");
				document.theForm.sp_acccrew.focus();
				return false;
			}
			if (document.theForm.sp_accguest.value == "")
			{
				alert(" Error !! \n You must enter a Guests !");
				document.theForm.sp_accguest.focus();
				return false;
			}
			if (document.theForm.sp_acccrewcabin.value == "")
			{
				alert(" Error !! \n You must enter a Cabins !");
				document.theForm.sp_acccrewcabin.focus();
				return false;
			}
			if (document.theForm.sp_accguestcabin.value == "")
			{
				alert(" Error !! \n You must enter a Cabins !");
				document.theForm.sp_accguestcabin.focus();
				return false;
			}

			if(document.theForm.sp_mainhp.checked==false && document.theForm.sp_mainkw.checked==false )
			{
				alert(" Error !! \n You Must select Main KW Or HP !");
				document.theForm.sp_mainhp.focus();
				return false;
			}
			if(document.theForm.sp_auxhp.checked==false && document.theForm.sp_auxkw.checked==false )
			{
				alert(" Error !! \n You Must select Auxilury KW Or HP !");
				document.theForm.sp_auxhp.focus();
				return false;
			}
			if(document.theForm.sp_maxMph==false && document.theForm.sp_maxKts.checked==false)
			{
				alert(" Error !! \n You Must select Speed  type Litter Or Gallon !");
				document.theForm.sp_maxhph.focus();
				return false;
			}
			if(document.theForm.sp_fuelgallon.checked==false && document.theForm.sp_fuelliter.checked==false)
			{
				alert(" Error !! \n You Must select Fuel type Litter Or Gallon !");
				document.theForm.sp_fuelgallon.focus();
				return false;
			}

			
		}
		return true;

}

function checktitle()
{
			//alert("checktitle.php?title="+escape(document.getElementById('title').value));
			http.open("GET", "checktitle.php?title="+escape(document.getElementById('field_myalbum_title').value), true);
			//http.open("GET", "checktitle.php?title=" + escape(document.tgetElementById('title').value), true);
			http.onreadystatechange = handleHttpResponse;
			http.send(null);
}
function handleHttpResponse() {
  if (http.readyState == 4) {
    results = http.responseText;
	 results = http.responseText.split("$");
	 alert(results);
	if(results==1)
	{
		alert(" Error !! \n This Title Already Exist ");
		document.theForm.field_myalbum_title.value="";
		document.theForm.field_myalbum_title.focus();
		
	}
	
  }
}

function handleHttpResponse_tag() {
  	if (http.readyState == 4) 
  	{
		// Split the comma delimited response into an array
		if(http.status == 200){
		var results = http.responseText;

		document.getElementById('tagerror').style.display = "none";
		document.getElementById('tagerror').innerHTML ='';
		
			if(results != '')
			{				
				document.getElementById('tagerror').style.display = "block";
				document.getElementById('tagerror').innerHTML = results;
				return false;
			}
		}
	}
}
var http = getHTTPObject(); // We create the HTTP Object

function checktag() 
{
  http.open("GET", "checkvalidtag.php?tag=" + escape(document.theForm.field_myalbum_keywords.value), true);
  http.onreadystatechange = handleHttpResponse_tag;
  http.send(null);
}

/*function insertcom(vid,cip,postedby)
{
	 http.open("GET", "insert_comment.php?user=" + escape(postedby)+"&vid="+escape(vid)+"&cip="+escape(cip)+"&descr="+escape(document.getElementById('text1').value), true);
	 http.onreadystatechange = handleHttpResponse;
	 http.send(null);
}*/
function getHTTPObject() 
{
  var xmlhttp;
   /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
  try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}

