
function offshoreSearch(form){

	var offshore = form.elements['offshore'].options[form.elements['offshore'].selectedIndex].text;

	var uk = form.elements['name'].value;

	

	var top = screen.height/6;

	var left = screen.width/4;

	if(offshore=="Select" && uk.length==0){

		alert('Please choose UK company name or country from the menu.');

		return false;

	}else if(offshore!="Select"){

		window.open("/other-namesearch.php?country="+offshore,"offshoreNameSearch","width=500,height=450,location=no,menubar==no,resizable=yes,toobal=no,left="+left+",top="+top);

	}else{

		form.submit();

	}

		

}






function companyNameEdit(app_id){



	window.open("/actions/choose_name.php?app_id="+app_id,"_self");

	

}

function companyNatureEdit(app_id){



	window.open("/actions/business_nature.php?app_id="+app_id,"_self");

	

}



function addDirector(app_id){
myAjax(1);
	window.open("/actions/add_director.php?app_id="+app_id,"_self");

}



function editDirector(app_id,officer_id){

	window.open("/actions/edit_director.php?app_id="+app_id+"&officer_id="+officer_id,"_self");

}



function editSecretary(app_id,officer_id){

	window.open("/actions/edit_secretary.php?app_id="+app_id+"&officer_id="+officer_id,"_self");

}



function editShareH(app_id,officer_id){

	window.open("/actions/edit_shareh.php?app_id="+app_id+"&officer_id="+officer_id,"_self");

}



function editCAddress(app_id,officer_id){

	window.open("/actions/edit_caddress.php?app_id="+app_id+"&officer_id="+officer_id,"_self");

}



function addSecretary(app_id){

	window.open("/actions/add_secretary.php?app_id="+app_id,"_self");

}



function addShareH(app_id){

	window.open("/actions/add_shareh.php?app_id="+app_id,"_self");

}



function addCAddress(app_id){

	window.open("/actions/add_caddress.php?app_id="+app_id,"_self");

}



function addFile(app_id){

	window.open("/actions/add_file.php?app_id="+app_id,"_self");

}







function removeOfficer(app_id,officer_id){

	var ans = confirm("Do you want to remove it?");

	if(ans==true)

		window.open("/actions/remove_officer.php?app_id="+app_id+"&officer_id="+officer_id,"_self");

}

function removeFile(app_id,officer_id){

	var ans = confirm("Do you want to remove this file?");

	if(ans==true)

		window.open("/actions/remove_file.php?app_id="+app_id+"&officer_id="+officer_id,"_self");

}



//application submission 

function showButton(){

	var agreeBox = document.getElementById("agreeBox");

	var sButton = document.getElementById("sbutton");

	

	if(agreeBox.checked==true){

	

		sButton.style.display = "block";

		

	}

	else

		sButton.style.display = "none";

}





//for the cart , shopping basket one

function calcDelivery(){

	var temp = document.getElementById("totalPrice");

	var temp1 = document.getElementById("deliveryM");

	

	temp.innerHTML = ""+(total+(temp1.value*1)).toFixed(2);

}



function addBookeeping(){

	var temp = document.getElementById("hours");

	if(!isNumber(temp.value)){

		alert('Please enter a number');

		return false;

	}

	if(temp.value<10){

		alert('Minimum Hours is 10.');

		return false;

	}

	window.location.assign("http://"+location.host+"/actions/engine.php?action=add&product_id=73&quantity="+temp.value);

	

}



function isNumber(value){

	for(var i=0;i<value.length;i++){

		var c = value.charAt(i);

		if(c<"0" | c>"9"){

			return false;

		}

	}

	return true;

}



function cNameSearch(){

	var cname  = document.getElementById("cname");

	window.location.assign("http://"+location.host+"/name-search.php?name="+cname.value);

}



function remove_app(app_id){

	var ans = confirm("Do you want to remove this application?");

	if(ans==true)

		//alert("/actions/remove_app.php?app_id="+app_id);

		window.open("/actions/remove_app.php?app_id="+app_id,"_self");

}



function checkLength(that){

	//alert(that.value);

	if(that.value.length>3)

	that.value = that.value.substring(0,3);

}
