function searchMe(){
if (document.searchform.searchfor.value=="")
	{
	alert("Please enter word or phrase to search for.")			
	document.searchform.searchfor.focus();	
	 return false;
	}
		
else if (document.searchform.searchfor.value.length<3)
	{
	alert("Search word should be at least 3 characters.")
	document.searchform.searchfor.focus();
	 return false;
	}
		
for (var i=0; i < document.searchform.searchsite.length; i++)
   {
   if (document.searchform.searchsite[i].checked)
      {
      var rad_val = document.searchform.searchsite[i].value;
      
      if (rad_val=="web")
		{
		window.open("http://www.google.com/search?sourceid=navclient&q="+document.searchform.searchfor.value);
		}		
      else if (rad_val=="site")
		{
			top.location.href="searchresults.asp?query="+document.searchform.searchfor.value;
		}            
		return false;     
      }
   }
}
function searchMeOpt(){
if (document.searchform.searchfor.value=="")
	{
	alert("Please enter word or phrase to search for.")			
	document.searchform.searchfor.focus();	
	 return false;
	}
		
else if (document.searchform.searchfor.value.length<3)
	{
	alert("Search word should be at least 3 characters.")
	document.searchform.searchfor.focus();
	 return false;
	}
		
for (var i=0; i < document.searchform.searchsite.length; i++)
   {
   if (document.searchform.searchsite[i].checked)
      {
      var rad_val = document.searchform.searchsite[i].value;
      
      if (rad_val=="web")
		{
		window.open("http://www.google.com/search?sourceid=navclient&q="+document.searchform.searchfor.value);
		}		
      else if (rad_val=="site")
		{
			top.location.href="searchresults.asp?query="+document.searchform.searchfor.value;
		}            
		return false;     
      }
   }
}

function ButtonOver(item) {
	item.className = "Button_sel";
	if (item.alt !=null) {
		window.status=item.alt;
	}
}

function ButtonOff(item) {
	item.className = "Button_unsel";
	window.status='C.F. Sharp ISS Port Agencies, Inc. - http://www.cfsharp.com/sharpiss/';
}function ConfirmAction(msg,action){
	if (confirm(msg)) {
	document.myform.action=action;
	document.myform.submit();}
}

function addcategory(msg,catid,action){
	var cat=prompt(msg,"");
	if (cat!=null)
	{
		//document.myform.action=action + "&cat=" + escape(cat);
		document.myform.action=action + "&catid=" + catid + "&cat=" + escape(cat);		
		document.myform.submit();
	}
}
function SendPageForm(){
	if (document.myform.sendtoaddress.value=="") {
		alert("Please enter the e-mail address to send this link to")
		document.myform.sendtoaddress.focus()
		return false
	}
	if (document.myform.sendtoaddress.value.length >0){
		i=document.myform.sendtoaddress.value.indexOf("@")
		j=document.myform.sendtoaddress.value.indexOf(".",i)
		k=document.myform.sendtoaddress.value.indexOf(",")
		kk=document.myform.sendtoaddress.value.indexOf(" ")
		jj=document.myform.sendtoaddress.value.lastIndexOf(".")+1
		len=document.myform.sendtoaddress.value.length
   
		if ((i>0) && (j>(i+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=3)) {
		} else {
			alert("Please enter a valid Email address.\n" + 
			document.myform.sendtoaddress.value + " is invalid.")
			document.myform.sendtoaddress.focus()	 
		return false}
	}
	if (document.myform.email.value=="") {
		alert("Please enter your e-mail address.")
		document.myform.email.focus()
		return false
	}
	if (document.myform.email.value.length >0){
		i=document.myform.email.value.indexOf("@")
		j=document.myform.email.value.indexOf(".",i)
		k=document.myform.email.value.indexOf(",")
		kk=document.myform.email.value.indexOf(" ")
		jj=document.myform.email.value.lastIndexOf(".")+1
		len=document.myform.email.value.length
   
		if ((i>0) && (j>(i+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=3)) {
		} else {
			alert("Please enter a valid Email address.\n" + 
			document.myform.email.value + " is invalid.")
			document.myform.email.focus()	 
		return false}
	}		
return true
}

function FeedbackForm(){
	if (document.myform.email.value=="") {
		alert("Please enter your e-mail address.")
		document.myform.email.focus()
		return false
	}
	if (document.myform.email.value.length >0){
		i=document.myform.email.value.indexOf("@")
		j=document.myform.email.value.indexOf(".",i)
		k=document.myform.email.value.indexOf(",")
		kk=document.myform.email.value.indexOf(" ")
		jj=document.myform.email.value.lastIndexOf(".")+1
		len=document.myform.email.value.length
   
		if ((i>0) && (j>(i+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=3)) {
		} else {
			alert("Please enter a valid Email address.\n" + 
			document.myform.email.value + " is invalid.")
			document.myform.email.focus()	 
		return false}
	}
	if (document.myform.subject.value=="") {
		alert("Please enter subject")
		document.myform.subject.focus()
		return false
	}
	if (document.myform.body.value=="") {
		alert("Please enter your message")
		document.myform.body.focus()
		return false
	}		
return true
}

function validateSignInForm(){
	if (document.myform.username.value=="") {
		alert("Please enter your username.")
		document.myform.username.focus()
		return false
	}
	if (document.myform.password.value=="") {
		alert("Please enter password")
		document.myform.password.focus()
		return false
	}
return true
}

function submitformplane(action){
	document.myform.action=action;
	document.myform.submit();
}

function submitform(asp){
	if (document.myform.prodname.value=="") {
		alert("Please enter product name")
		document.myform.prodname.focus()
	return false
	}
	document.myform.action = asp;	
	document.myform.submit();
	return true
}

function submitformCat(asp){
	if (document.myform.actioncatname.value=="") {
		alert("Please enter category")
		document.myform.actioncatname.focus()
	return false
	}
	document.myform.action = asp;	
	document.myform.submit();
	return true
}

function openSmallPopup(url) {
	myPopup = window.open(url,Math.floor(Math.random() * 99999),'width=450,height=400,top=100,left=200,resizable=yes,scrollbars=yes,toolbars=no,statusbar=yes,titlebar=no');
	myPopup.focus();
}

function checkAction(){
	ok=false
	a = document.myform.xaction[document.myform.xaction.selectedIndex].value
	if (a=='1'){
		ok=true	
	} else {
		if (a=='2'||a=='3'||a=='4'){
			if (document.myform.parentid_.value=='1') {
				ok=true
			} else {
				msg='Please select a parent category !'
			}
		}
		if (a=='5'||a=='6'||a=='7'){
			if (document.myform.catid_.value=='1') {
				ok=true
			} else {
				msg='Please select a sub category !'
			}
		}
		if (a=='8'||a=='9'){
			if (document.myform.prodid_.value=='1') {
				ok=true
			} else {
				msg='Please select an item !'
			}
		}
		if (a=='21'){
			ok=true
		}
		
		if (a=='22'){
			ok=true
		}
		
		if (a=='23'){
			ok=true
		}
	}
	if (ok) {
		document.myform.submit()
	} else {
		alert(msg)
	}
}

function putParent(){
	x=parseFloat(document.myform.parentid.length)
	if (!isNaN(x)) {
		for (j=0; j<document.myform.parentid.length;j++){
			if (document.myform.parentid[j].checked){
				document.myform.parentid_.value=1
			}
		}
	} else {
		if (document.myform.parentid.checked){
			document.myform.parentid_.value=1
		}
	}	
}

function putCat(){
	x=parseFloat(document.myform.catid.length)
	if (!isNaN(x)) {
		for (j=0; j<document.myform.catid.length;j++){
			if (document.myform.catid[j].checked){
				document.myform.catid_.value=1
			}
		}
	} else {
		if (document.myform.catid.checked){
			document.myform.catid_.value=1
		}
	}	
}

function putProd(){
	x=parseFloat(document.myform.prodid.length)
	if (!isNaN(x)) {
		for (j=0; j<document.myform.prodid.length;j++){
			if (document.myform.prodid[j].checked){
				document.myform.prodid_.value=1
			}
		}
	} else {
		if (document.myform.prodid.checked){
			document.myform.prodid_.value=1
		}
	}
}

function paging(cmd){
	ok=false
	document.myform.action='default(manager).asp'
	document.myform.cmd.value=cmd
	if (cmd=='-') {
		if (parseFloat(document.myform.pno.value)>1) {
			document.myform.pno.value = parseFloat(document.myform.pno.value) -1
			ok=true
		}
	}
	
	if (cmd=='+') {
		if (parseFloat(document.myform.pno.value)<parseFloat(document.myform.pcount.value)) {
			document.myform.pno.value = parseFloat(document.myform.pno.value) +1
			ok=true
		}
	}
	
	if (cmd=='') {
		ok=true
	}
	
	if (ok) {
	document.myform.submit()
	}
}