function setSearchColor(){
if($('email').value=='Enter Email'){
	$('email').style.color='#808080';
	}
	else
	{
	$('email').style.color='#000000';
	}
}
function subscription_submit(){
	var email=$F("email");
	var pars="&email="+email;
	
	AJAX_request("get","/ajax_includes/subscription_req.php","subscription_div",pars,"");
}
function div2_show_hide(value){
	if(value==1){
		$('training_on_other_ys').show();	
	}else{
		$('training_on_other_ys').hide();
	}
		
}
function div1_show_hide(value){
	if(value==1){
		$('training_on_fs_ys').show();	
	}else{
		$('training_on_fs_ys').hide();
	}
		
}
function load_course(){
	var course_id=$F('training_course');
	
	
	var pars="&course_id="+course_id;
	var method="post";
	var url="/ajax_includes/course_details.php";
	var div="course_div";
	if($(div)){
		var user_function="";
		AJAX_request(method,url,div,pars,user_function);
	}else{
		window.location="/index.php?p="+page;
	}
}
function news_delete(nid){
	var pars="&delete=1&nid="+nid;
	var method="post";
	var url="/others/news_upload.php";
	var div="content_div";
	if($(div)){
		var user_function="";
		AJAX_request(method,url,div,pars,user_function);
	}else{
		window.location="/index.php?p="+page;
	}
}
function news_update(){
	var n_title=$F('n_title');
	var n_link=$F('link');
	var n_source=$F('source');
	var publish_on=$F('publish_on');
	var nid=$F('nid');

	var alertText="";

	if(n_title=="")
		alertText+="You must enter News Title\n";
	if(n_link=="")
		alertText+="You must enter News Link\n";
	if(n_source=="")
		alertText+="You must enter News Source\n";
	if(publish_on=="")
		alertText+="You must enter News Publish Date\n";

	if(alertText){
		alert(alertText);
		return false;
	}

	var pars="&edit=1&n_title="+encodeURIComponent(n_title)+"&n_link="+encodeURIComponent(n_link)+"&n_source="+encodeURIComponent(n_source)+"&publish_on="+encodeURIComponent(publish_on)+"&nid="+nid;
	var method="post";
	var url="/others/news_upload.php";
	var div="content_div";
	if($(div)){
		var user_function="";
		AJAX_request(method,url,div,pars,user_function);
	}else{
		window.location="/index.php?p="+page;
	}
}

function edit_form(page,pars){
	var method="get";
	var url=page;
	var div="content_div";
	
		var user_function="";
		AJAX_request(method,url,div,pars,user_function);
	
}

function press_delete(press_id){
	var pars="&delete=1&press_id="+press_id;
	var method="post";
	var url="/others/press_r_upload.php";
	var div="content_div";
	if($(div)){
		var user_function="";
		AJAX_request(method,url,div,pars,user_function);
	}else{
		window.location="/index.php?p="+page;
	}
}
function press_update(){
	var p_title=$F('p_title');
	var p_details=$F('p_details');
	var publish_on=$F('publish_on');
	var press_id=$F('press_id');
	
	var alertText="";

	if(p_title=="")
		alertText+="You must enter Press Release Title\n";
	if(p_details=="")
		alertText+="You must enter Press Details\n";
	if(publish_on=="")
		alertText+="You must enter  Publish Date\n";

	if(alertText){
		alert(alertText);
		return false;
	}

	var pars="&edit=1&p_title="+encodeURIComponent(p_title)+"&p_details="+encodeURIComponent(p_details)+"&publish_on="+encodeURIComponent(publish_on)+"&press_id="+press_id;
	//alert(pars);
	var method="post";
	var url="/others/press_r_upload.php";
	var div="content_div";
	if($(div)){
		var user_function="";
		AJAX_request(method,url,div,pars,user_function);
	}else{
		window.location="/index.php?p="+page;
	}
}

function press_upload(){
	var p_title=$F('p_title');
	var p_details=$F('p_details');
	var publish_on=$F('publish_on');
	
	var alertText="";

	if(p_title=="")
		alertText+="You must enter Press Release Title\n";
	if(p_details=="")
		alertText+="You must enter Press Details\n";
	if(publish_on=="")
		alertText+="You must enter  Publish Date\n";

	if(alertText){
		alert(alertText);
		return false;
	}

	var pars="&submit=1&p_title="+encodeURIComponent(p_title)+"&p_details="+encodeURIComponent(p_details)+"&publish_on="+encodeURIComponent(publish_on);
	//alert(pars);
	var method="post";
	var url="/others/press_r_upload.php";
	var div="content_div";
	if($(div)){
		var user_function="";
		AJAX_request(method,url,div,pars,user_function);
	}else{
		window.location="/index.php?p="+page;
	}
}
function qlink_upload(){
	var l_title=$F('l_title');
	var link_add=$F('link_add');
	var link_type=$F('link_type');
	
	var pars="&submit=1&l_title="+encodeURIComponent(l_title)+"&link_add="+encodeURIComponent(link_add)+"&link_type="+link_type;
	var method="post";
	var url="/others/qlink_upload.php";
	var div="content_div";
	if($(div)){
		var user_function="";
		AJAX_request(method,url,div,pars,user_function);
	}else{
		window.location="/index.php?p="+page;
	}
}
function latest_news_upload(){
	var n_title=$F('n_title');
	var n_details=$F('n_details');
	
	var pars="&submit=1&n_title="+encodeURIComponent(n_title)+"&n_details="+encodeURIComponent(n_details);
	var method="post";
	var url="/others/l_news_upload.php";
	var div="content_div";
	if($(div)){
		var user_function="";
		AJAX_request(method,url,div,pars,user_function);
	}else{
		window.location="/index.php?p="+page;
	}
}
function news_upload(){
	var n_title=$F('n_title');
	var n_link=$F('link');
	var n_source=$F('source');
	var publish_on=$F('publish_on');
	var alertText="";

	if(n_title=="")
		alertText+="You must enter News Title\n";
	if(n_link=="")
		alertText+="You must enter News Link\n";
	if(n_source=="")
		alertText+="You must enter News Source\n";
	if(publish_on=="")
		alertText+="You must enter News Publish Date\n";

	if(alertText){
		alert(alertText);
		return false;
	}

	var pars="&submit=1&n_title="+encodeURIComponent(n_title)+"&n_link="+encodeURIComponent(n_link)+"&n_source="+encodeURIComponent(n_source)+"&publish_on="+encodeURIComponent(publish_on);
	var method="post";
	var url="/others/news_upload.php";
	var div="content_div";
//alert(pars);
	if($(div)){
		var user_function="";
		AJAX_request(method,url,div,pars,user_function);
	}else{
		alert('Error in News Upload');
		//window.location="/index.php?p="+page;
	}
}
function pwd_change(){
		
		var old_pwd=$F('old_pwd');
		var new_pwd=$F('new_pwd');
		var conf_pwd=$F('conf_pwd');	
		
		if((old_pwd=="") || (new_pwd=="") || (conf_pwd=="")){
			alert(" Password field blank not accepted.");
			return false;
		}else{
			
			if(new_pwd.length >=6){
				if(new_pwd!=conf_pwd){
					alert('New Password & Confirmed Password not match.');
					return false;
				}else{
					var method="get";
					var url="u_area/e_pwd_chang.php";
					var div="pwd_change";
					var pars="&opwd="+old_pwd+"&new_pwd="+new_pwd;
					var user_function="";
					AJAX_request(method,url,div,pars,user_function)
				}
			}else{
				alert('Password must be 6 characters');
				return false;
			}	
		}			
	}

function logout(){
	var pars="";
	var url="u_area/p_logout.php";
	var div="user_div";
	var user_function="setTimeout('go_index()',1000)";
	AJAX_request("POST",url,div,pars,user_function);	
}

function go_index(){
	window.location='/index.php';
}
function login(){
		
		var uname=$F('uname');
		var pwd=$F('pwd');		
		if(uname==""){
			alert('username blank not accepted');
			return false;
		}
		if(pwd==""){
			alert('password blank not accepted');
			return false;
		}	
		var pars="&uname="+uname+"&pwd="+pwd;
		
		var url="/u_area/p_login.php";
		var div="user_div";
		var user_function="";
		AJAX_request("POST",url,div,pars,user_function);	
}
function search_result(){

	
		var s_div=$('search_div');
		s_div.show();
		
		var s_f_div=$('search_form_div');
		s_f_div.hide();
	
		
		
		var pars ;
		var ct=$F('course_title');
		var pn=$F('pname');
		var gn=$F('gender');
		var cn=$F('cname');
		var bt=$F('bus_type');
		var eq=$F('edu_qua');
		var td=$F('tduration');
		var dm=$F('dm');
		var tp=$F('tprovider');
		var tpl=$F('tplace');
	
		if(ct>=9){
				var url = '../others/participant_list.php' ;
		}else if(ct<9){
			var url = '../ajax_includes/process_training_search.php' ;
		}

		pars="ct="+ct+"&pn="+pn+"&gn="+gn+"&cn="+cn+"&bt="+bt+"&eq="+eq+"&td="+td+"&dm="+dm+"&tp="+tp+"&tpl="+tpl;
		$('search_div').innerHTML="<img src=\"loading.gif\"  /> <strong>Loading...</strong>";

		//window.location=url+"?"+pars;
		var myAjax = new Ajax.Request( url, { method: 'get', parameters: pars, onComplete: show_result });
	}
	
	function show_result(originalRequest){
		
		var response_txt=originalRequest.responseText;
	//	alert(response_txt);
		$('search_div').innerHTML=response_txt;
		
	}
// *****************************



function paging(new_offset,limit){

		var s_div=$('search_div');
		s_div.show();
		
		var s_f_div=$('search_form_div');
		s_f_div.hide();
		
	
		
		var ct=$F('course_title');
		var pn=$F('pname');
		var gn=$F('gender');
		var cn=$F('cname');
		var bt=$F('bus_type');
		var eq=$F('edu_qua');
		var td=$F('tduration');
		var dm=$F('dm');
		var tp=$F('tprovider');
		var tpl=$F('tplace');
		
		
		var url = '../ajax_includes/process_training_search.php' ;
		var pars ;
		pars="ct="+ct+"&pn="+pn+"&gn="+gn+"&cn="+cn+"&bt="+bt+"&eq="+eq+"&td="+td+"&dm="+dm+"&tp="+tp+"&tpl="+tpl;
		var new_loc=pars+"&offset="+new_offset+"&limit="+limit;
		pars=new_loc;
		$('search_div').innerHTML="<img src=\"loading.gif\"  /> <strong>Loading...</strong>";
		var myAjax = new Ajax.Request( url, { method: 'get', parameters: pars, onComplete: show_result });
	
}
//======================
function smer_search(offset,limit){
		
		if($('person_type')){
			Set_Cookie( "person_type", $F('person_type'), 20, "/", "", "" ) ;	
		}
		
		if($('spec_area')){
			Set_Cookie( "spec_area", $F('spec_area'), 20, "/", "", "" ) ;	
		}
		
		if($('area_priority')){
			Set_Cookie( "area_priority", $F('area_priority'), 20, "/", "", "" ) ;	
		}
		
		if($('work_exp_year')){
			Set_Cookie( "work_exp_year", $F('work_exp_year'), 20, "/", "", "" ) ;	
		}
		
		if($('cons_exp_year')){
			Set_Cookie( "cons_exp_year", $F('cons_exp_year'), 20, "/", "", "" ) ;	
		}
		if($('academic_degree')){
			Set_Cookie( "academic_degree", $F('academic_degree'), 20, "/", "", "" ) ;	
		}
	
		var pars="&submit=1&offset="+offset+"&limit="+limit;
		//alert(pars);
		var url="../ajax_includes/sme_resource.php";
		var div="content_div";
		var user_function="";
		AJAX_request("GET",url,div,pars,user_function);
}

function loan_search(){

		var bank_id=$F('bank_id');
		var product_id=$F('sme_product_id');
		var branch_id=$F('branch_id');
		var entrepreneurs_gender=$F('entrepreneurs_gender');
		var entrepreneurs_age=$F('entrepreneurs_age');			
		var	entrepreneurs_education=$F('entrepreneurs_education');
		var	entrepreneurs_exp_in_same_line=$F('entrepreneurs_exp_in_same_line');
		var	operational_experience=$F('operational_experience');
		var	annual_sales_turn_over=$F('annual_sales_turn_over');
		var annual_income=$F('annual_income');
		var	annual_profit=$F('annual_profit');
		var	collateral_type=$F('collateral_type');
		var	collateral_value=$F('collateral_value');
		var	monthly_cash_flow=$F('monthly_cash_flow');
		var	total_assets=$F('total_assets');
		var num_of_employee=$F('num_of_employee');
		var personal_gurantee=$F('personal_gurantee');
		var	sme_sector=$F('sme_sector');
		var vat=$F('vat');
		var license=$F('license');
		var	tin=$F('tin');
		var	exportable=$F('exportable');
		
		var pars="&submit=1&bank_id="+bank_id+"&product_id="+product_id+"&branch_id="+branch_id+"&entrepreneurs_gender="+entrepreneurs_gender+"&entrepreneurs_age="+entrepreneurs_age+"&entrepreneurs_education="+entrepreneurs_education+"&entrepreneurs_exp_in_same_line="+entrepreneurs_exp_in_same_line+"&operational_experience="+operational_experience+"&annual_sales_turn_over="+annual_sales_turn_over+"&annual_income="+annual_income+"&annual_profit="+annual_profit+"&collateral_type="+collateral_type+"&collateral_value="+collateral_value+"&monthly_cash_flow="+monthly_cash_flow+"&num_of_employee="+num_of_employee+"&personal_gurantee="+personal_gurantee+"&sme_sector="+sme_sector+"&vat="+vat+"&license="+license+"&tin="+tin+"&exportable="+exportable;
		//alert(pars);
		var url="../ajax_includes/sme_loan_search.php";
		var div="content_div";
		var user_function="";
		AJAX_request("POST",url,div,pars,user_function);
	
}
function page_load(page){
	var method="get";
	var url=page;
	var div="content_div";
	if($(div)){
		var pars="&1";
		var user_function="";
		AJAX_request(method,url,div,pars,user_function);
	}else{
		window.location="/index.php?p="+page;
	}
}

function sme_mentors(id){
	var method="get";
	var url="ajax_includes/sme_mentors.php";
	var div="content_div";
	if($(div)){
		var pars="&id="+id;
		var user_function="";
		AJAX_request(method,url,div,pars,user_function);
	}else{
		window.location="/index.php?mid="+id;
	}
}
function show_directors(session_id){
	AJAX_request("get","ajax_includes/board_directors.php","director_div","&sid="+session_id);	
}
function info_details(info_id){
	var method="get";
	var url="ajax_includes/info_details.php";
	var div="content_div";
	if($(div)){
		var pars="&id="+info_id;
		var user_function="";
		AJAX_request(method,url,div,pars,user_function);	
	}else{
		window.location="/index.php?nid="+info_id;
	}
	
}

function mypopup(page)
 {
   mywindow = window.open (page,"mywindow","resizable=1,location=1,status=1,scrollbars=1,width=650,height=400");
  	var left = (screen.width-650)/2;
	var top = (screen.height-400)/2;
	mywindow.moveTo(left,top);
    mywindow.window.focus();
 } 
 
 function seminer_open_window(mid){
	//	window.open("show_meeting.php?id="+id,null,"height=600,width=800,status=yes,toolbar=no,menubar=no,location=no");
		day = new Date();
		id = day.getTime();
		var URL="../others/seminer_show.php?id="+mid;
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=850,height=600,left = 212,top = 50');");
	}

	function open_window(mid){
	//	window.open("show_meeting.php?id="+id,null,"height=600,width=800,status=yes,toolbar=no,menubar=no,location=no");
		day = new Date();
		id = day.getTime();
		var URL="others/show_meeting.php?id="+mid;
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=750,height=600,left = 212,top = 50');");
	}
	function open_bio_data(did){
	//	window.open(,null,"height=400,width=700,status=yes,toolbar=no");
		day = new Date();
		id = day.getTime();
		var URL="../others/show_bio_data.php?id="+did;
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=750,height=600,left = 212,top = 50');");
	}
	
	function open_organogram_window(){
	//	window.open("show_meeting.php?id="+id,null,"height=600,width=800,status=yes,toolbar=no,menubar=no,location=no");
		day = new Date();
		id = day.getTime();
		var URL="../others/organogram.php?";
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=950,height=600,left = 200,top = 50');");
	}
	
	
	 // JavaScript Document

function load_image(){

var pic="file:///"+ document.getElementById('bank_logo').value;


	document.getElementById('bank_logo_img').src=pic;

}

function show_row(control_name,hidden_row_id,compare_value){

	var control_value=document.getElementById(control_name).value;
	var style2 = document.getElementById(hidden_row_id).style;
	if(control_value==compare_value){
		style2.display = "";
	}else{
		style2.display = "none";	
	}
	
}

function ajax_product_list(){

	var bank_id=document.getElementById('bank_id').value;
	var product_id=0;
	document.getElementById('product_list').innerHTML="<img src=\"/images/loading.gif\" /> ";
  
  	ajax_list_process("bank_id="+bank_id+"&select_id="+product_id); 
	

}
function ajax_list_process(param) {
//alert(param);
		var url = 'functions/process_product_list.php' ;
		var pars =  param ;
		var myAjax = new Ajax.Request( url, { method: 'get', parameters: pars, onComplete: showResponse });
	
	}

	function showResponse(originalRequest){

		
				//originalRequest.responseText
			var response_txt=originalRequest.responseText;
			//alert(response_txt);
			document.getElementById('product_list').innerHTML=response_txt;
		
		
	}
	
	
// *************** Branch

function ajax_branch_list(){

	var bank_id=document.getElementById('bank_id').value;
	var product_id=0;
	document.getElementById('branch_id_div').innerHTML="<img src=\"/images/loading.gif\" /> ";
  
  	ajax_branch_list_process("bank_id="+bank_id+"&select_id="+product_id); 
	

}
function ajax_branch_list_process(param) {
//alert(param);
		var url = 'functions/process_ajax_branch_list.php' ;
		var pars =  param ;
		var myAjax = new Ajax.Request( url, { method: 'get', parameters: pars, onComplete: show_branch_list });
	
	}

	function show_branch_list(originalRequest){
		var response_txt=originalRequest.responseText;
		document.getElementById('branch_id_div').innerHTML=response_txt;
	}

// ************** END
	
function sme_paging(new_offset,limit){
	
	window.location="sme_loan_requirements.php?action=list&offset="+new_offset+"&limit="+limit;
}

function sme_search_paging(new_offset,limit){
	
	window.location="sme_loan_search.php?submit=1&offset="+new_offset+"&limit="+limit;
}

