 
function enable(val){
	row=document.getElementById("ur");
	if(val=='Y'){
		row.style.display = ''; 
		document.getElementById("ur").innerHTML='<input id="url" name="url" class="frm" type="text" size="35" value="Please type the address here." onfocus="javascript:callme(this.name,this.value,\'Please type the address here.\');" style="color:#7F7F7F;" />';
		}
	else{
		row.style.display = 'none';
		document.getElementById("ur").innerHTML='';
		}
}
$().ready(function() {
	// validate the comment form when it is submitted
	$("#registerUs").validate();
	
});
function callme(name,val1,val2)
{
 if(val1==val2)
 {
  switch(name){
	            case "contactname":
				document.forms[0].contactname.value='';
				document.forms[0].contactname.style.color='#333333';
				break;
				case "organization":
				document.forms[0].organization.value='';
				document.forms[0].organization.style.color='#333333';
				break;
				case "add1":
				document.forms[0].add1.value='';
				document.forms[0].add1.style.color='#333333';
				break;
				case "add2":
				document.forms[0].add2.value='';
				document.forms[0].add2.style.color='#333333';
				break;
				case "city":
				document.forms[0].city.value='';
				document.forms[0].city.style.color='#333333';
				break;
				case "zip":
				document.forms[0].zip.value='';
				document.forms[0].zip.style.color='#333333';
				break;			
				case "url":
				document.forms[0].url.value='';
				document.forms[0].url.style.color='#333333';
				break;
				

	 }
 }
}
function validateForm(){
var len=document.registerUs.elements.length;
var con=0;
for(var i=0;i<len;i++){
	  if(document.registerUs.elements[i].name!='zip2'){
	  switch(document.registerUs.elements[i].name){
	            case "contactname":
				if(document.forms[0].contactname.value=='Name')
				con=con+1;
				else if(trim1(document.forms[0].contactname.value)==''){
					document.forms[0].contactname.value='Name';
					document.forms[0].contactname.style.color='#7F7F7F';
					con=con+1;
				}
				break;
				case "organization":
				if(document.forms[0].organization.value=='Organization Name')
				con=con+1;
				else if(trim1(document.forms[0].organization.value)==''){
					document.forms[0].organization.value='Organization Name';
					document.forms[0].organization.style.color='#7F7F7F';
					con=con+1;
				}
				break;
				case "add1":
				if(document.forms[0].add1.value=='Street Address')
				con=con+1;
				else if(trim1(document.forms[0].add1.value)==''){
					document.forms[0].add1.value='Street Address';
					document.forms[0].add1.style.color='#7F7F7F';
					con=con+1;
				}
				break;
				case "add2":
				if(trim1(document.forms[0].add2.value)==''){
					document.forms[0].add2.value='Address Line2';
					document.forms[0].add2.style.color='#7F7F7F';
				}
				break;
				case "city":
				if(document.forms[0].city.value=='City')
				con=con+1;
				else if(trim1(document.forms[0].city.value)==''){
					document.forms[0].city.value='City';
					document.forms[0].city.style.color='#7F7F7F';
					con=con+1;
				}
				break;
				case "zip1":
				if(document.forms[0].zip.value=='Zip')
				con=con+1;
				else if(trim1(document.forms[0].zip.value)==''){
					document.forms[0].zip.value='Zip';
					document.forms[0].zip.style.color='#7F7F7F';
					con=con+1;
				}
				break;
				case "url":
				if(document.forms[0].url.value=='Please type the address here.')
				con=con+1;
				else if(trim1(document.forms[0].url.value)==''){
					document.forms[0].url.value='Please type the address here.';
					document.forms[0].url.style.color='#7F7F7F';
					con=con+1;
				}
				break;
	 }
	  
	  }
  }
  
  if(con>0){
  document.getElementById("error").innerHTML='<font style="color:#FF0000 !important;font-size:11px;font-style:italic;font-weight:bold;">Please fill all required fileds. They are marked with *.</font>';
  scrollTo(0,0);
  return false;
  }
  else{
  document.getElementById("error").innerHTML='';
  return true;
  }

function trim1(text) {
		return (text || "").replace( /^\s+|\s+$/g, "" );
	}
}
