function submit_articol()
{
  if (document.frm2.url.value == ""){
  alert('Va rugam introduceti adresa site-ului dumneavoastra!');
  return;
  }
  if (document.frm2.titlu.value == ""){
         alert('Va rugam introduceti titlul articolului!');
         return;
  }
  if (document.frm2.corp.value == ""){
         alert('Va rugam introduceti continutul articolului!');
         return;
  }
  alert('Articolul dumneavoastra a fost trimis cu succes catre echipa ExpoShop!');
   document.frm1.target = "";
   document.frm2.submit();
}

function roll_over(img_name, img_src)
   {
   document[img_name].src = "http://www.exposhop.ro/Resources/Images/rom/"+img_src+".jpg";
   window.scrollTo(0,0);
   }

function addemail()
{
   document.frm1.target = "";
   document.frm1.submit();
	
}
	
function voteaza(uid)
{
   document.frm.action.value="voteaza";
   document.frm.pid.value = uid;
   document.frm.target = "";
   document.frm.submit();
}
function voteaza2(uid)
{
   document.frm.action.value="voteaza2";
   document.frm.pid.value = uid;
   document.frm.target = "";
   document.frm.submit();
}
function voteaza4(uid)
{
   document.frm.action.value="voteaza4";
   document.frm.pid.value = uid;
   document.frm.target = "";
   document.frm.submit();
}
function voteaza5(uid)
{
   document.frm.action.value="voteaza5";
   document.frm.pid.value = uid;
   document.frm.target = "";
   document.frm.submit();
}

function regvisit()
{
   document.frm.action.value="regvisit";
   document.frm.target = "";
   document.frm.submit();
}
function submit_regvisit()
{
   document.frm.action.value="submit_regvisit";
   document.frm.target = "";
   document.frm.submit();
}
function login()
{
   document.frm.action.value="login";
   document.frm.target = "";
   document.frm.submit();
}
function submit_chestionar()
{
   document.frm.action.value="submit_chestionar";
   document.frm.target = "";
   document.frm.submit();
}
function messenger()
{
	alert('aa');
	
}
function trimite_mesaj()
{
   document.frm.action.value="trimite_mesaj";
   document.frm.target = "";
   document.frm.submit();		
}	
function trimite_comentariu()
{
   document.frm.action.value="trimite_comentariu";
   document.frm.target = "";
   document.frm.submit();		
}	


























function settings_adduser()
{
if (document.frm.username.value == ""){
alert('Please fill username field!');return;
}
if (document.frm.password.value == ""){
alert('Please fill password field!');return;
}
   document.frm.action.value="settings_adduser";
   document.frm.target = "";
   document.frm.submit();		
}
	
function manuals()
{
   document.frm.action.value="manuals";
   document.frm.target = "";
   document.frm.submit();		
}	
function submit_manuals()
{
   document.frm.action.value="submit_manuals";
   document.frm.target = "";
   document.frm.submit();		
}	
function emanuals()
{
   document.frm.action.value="manuals";
   document.frm.sourcelanguage.value = document.frm.multilanguage.value;
   document.frm.target = "";
   document.frm.submit();		
}	


function gmanuals()
{
   document.frm.action.value="gmanuals";
   document.frm.target = "";
   document.frm.submit();		
}	
function submit_gmanuals()
{
   document.frm.action.value="submit_gmanuals";
   document.frm.target = "";
   document.frm.submit();		
}	
function egmanuals()
{
   document.frm.action.value="gmanuals";
   document.frm.sourcelanguage.value = document.frm.multilanguage.value;
   document.frm.target = "";
   document.frm.submit();		
}	



function xcheckAll(field)
{
for (i = 0; i < document.frm.elements.length; i++){
	document.frm.elements[i].checked = true ;
}	
}
function backgrounds()
{
   document.frm.action.value="backgrounds";
   document.frm.target = "";
   document.frm.submit();
}	

function submit_grammar_pics()
{
   document.frm.action.value="submit_grammar_pics";
   document.frm.target = "";
   document.frm.submit();
}
function remove_backgroundpic1()
{
   document.frm.action.value="remove_backgroundpic1";
   document.frm.target = "";
   document.frm.submit();
}	
function remove_backgroundpic2()
{
   document.frm.action.value="remove_backgroundpic2";
   document.frm.target = "";
   document.frm.submit();
}	
function xuncheckAll(field)
{
for (i = 0; i < document.frm.elements.length; i++){
	document.frm.elements[i].checked = false ;
}
}
function remove_lessonpic()
{
   document.frm.action.value="remove_lessonpic";
   document.frm.target = "";
   document.frm.submit();
}
	
function overwrite_address()
{
var answer = confirm("Are you sure you want to overwrite the address allocated to current serial number?")
    if (answer){
   document.frm.action.value="overwrite_address";
   document.frm.target = "";
   document.frm.submit();
    }
}	

function ov_address(uid)
{
var answer = confirm("Are you sure you want to overwrite the address allocated to current serial number?")
    if (answer){
   document.frm.action.value="overwrite_address";
   document.frm.rrig.value = uid;
   document.frm.target = "";
   document.frm.submit();
    }
}	
function submit_reginfo()
{
   document.frm.action.value="submit_reginfo";
   document.frm.target = "";
   document.frm.submit();
}
	
function edit_reginfo(uid)
{
   document.frm.action.value="edit_reginfo";
   document.frm.rrig.value = uid;
   document.frm.target = "";
   document.frm.submit();
}	
function send_email(uid)
{
   document.frm.action.value="send_email";
   document.frm.rrig.value = uid;
   document.frm.target = "";
   document.frm.submit();
}	
function submit_sendmail(uid)
{
   document.frm.action.value="submit_sendmail";
   document.frm.rrig.value = uid;
   document.frm.target = "";
   document.frm.submit();
}	

function submit_registrations()
{
   document.frm.action.value="submit_registrations";
   document.frm.target = "";
   document.frm.submit();
}
	
function registrations()
{
   document.frm.action.value="registrations";
   document.frm.target = "";
   document.frm.submit();
}	
function submit_messages()
{
   document.frm.action.value="submit_messages";
   document.frm.target = "";
   document.frm.submit();
}	
function messages()
{
   document.frm.action.value="messages";
   document.frm.target = "";
   document.frm.submit();
}	
function emessages()
{
   document.frm.action.value="messages";
   document.frm.langid.value = document.frm.multilanguage.value;
   document.frm.target = "";
   document.frm.submit();
}	
function list_locked()
{
   document.frm.action.value="list_locked";
   document.frm.target = "";
   document.frm.submit();
}	
function pending_serials()
{
   document.frm.action.value="pending_serials";
   document.frm.target = "";
   document.frm.submit();
}	
function questions()
{
   document.frm.action.value="questions";
   document.frm.target = "";
   document.frm.submit();
}	
function submit_update_translate()
{
   document.frm.action.value="submit_update_translate";
   document.frm.target = "";
   document.frm.submit();
}
	
function ematch()
{
   document.frm.action.value="match_key";
   document.frm.langid.value = document.frm.multilanguage.value;
   document.frm.target = "";
   document.frm.submit();
}

function equestions()
{
   document.frm.action.value="questions";
   document.frm.langid.value = document.frm.multilanguage.value;
   document.frm.target = "";
   document.frm.submit();
}
function filter_serials()
{
   document.frm.action.value="filter_serials";
   document.frm.target = "";
   document.frm.submit();
}	

function lockserial(ser)
{
   document.frm.action.value="lockserial";
   document.frm.serial.value=ser;
   document.frm.target = "";
   document.frm.submit();
}	
function unlockserial(ser)
{
   document.frm.action.value="unlockserial";
   document.frm.serial.value=ser;
   document.frm.target = "";
   document.frm.submit();
}	

function register_information(ser)
{
   document.frm.action.value="register_information";
   document.frm.serial.value=ser;
   document.frm.target = "";
   document.frm.submit();
}
	
function submit_match()
{
   document.frm.action.value="submit_match";
   document.frm.target = "";
   document.frm.submit();
}
	
function match_key()
{
   document.frm.action.value="match_key";
   document.frm.target = "";
   document.frm.submit();
}	
function edit_translate(uid)
{
   document.frm.action.value="edit_translate";
   document.frm.lid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}
function edit_page_name()
{
   document.frm.action.value="edit_page_name";
   document.frm.target = "";
   document.frm.submit();
}
function l_edit_page_name()
{
   document.frm.action.value="edit_page_name";
   document.frm.sourcelanguage.value = document.frm.multilanguage.value;
   document.frm.target = "";
   document.frm.submit();
}


function submit_update_page()
{
   document.frm.action.value="submit_update_page";
   document.frm.target = "";
   document.frm.submit();
}
	
function copycourse()
{
   document.frm.action.value="copycourse";
   document.frm.target = "";
   document.frm.submit();
}
function submit_copy_course()
{
   document.frm.action.value="submit_copy_course";
   document.frm.target = "";
   document.frm.submit();
}
function submit_newsourcelanguage()
{
   document.frm.action.value="submit_newsourcelanguage";
   document.frm.target = "";
   document.frm.submit();
}

	
function menu_dash()
{
   document.frm.action.value="home";
   document.frm.target = "";
   document.frm.submit();
}
function addnewsourcelanguage()
{
   document.frm.action.value="addnewsourcelanguage";
   document.frm.target = "";
   document.frm.submit();
}


function menu_security()
{
   document.frm.action.value="security";
   document.frm.target = "";
   document.frm.submit();
}
function remove_logo()
{
   document.frm.action.value="remove_logo";
   document.frm.target = "";
   document.frm.submit();
}
function settings()
{
   document.frm.action.value="settings_languages";
   document.frm.target = "";
   document.frm.submit();
}
function settings_edituser(uid)
{
   document.frm.action.value="settings_edituser";
   document.frm.lid.value = uid;
   document.frm.target = "";
   document.frm.submit();
}

	
function settings_editlanguage(uid)
{
   document.frm.action.value="settings_editlanguage";
   document.frm.lid.value = uid;
   document.frm.target = "";
   document.frm.submit();
}
function delete_langpicture(uid)
{
var answer = confirm("Are you sure you want to remove this picture?")
    if (answer){
   document.frm.action.value="settings_deletelangpic";
   document.frm.lid.value=uid;
   document.frm.target = "";
   document.frm.submit();
    }
}	

function settings_updatelanguage()
{
   document.frm.action.value="settings_updatelanguage";
   document.frm.target = "";
   document.frm.submit();
}
function settings_addlanguage()
{
   document.frm.action.value="settings_addlanguage";
   document.frm.target = "";
   document.frm.submit();
}

function new_lesson()
{
   document.frm.action.value="new_lesson";
   document.frm.target = "";
   document.frm.submit();
}
function addnewpair()
{
   document.frm.action.value="addnewpair";
   document.frm.target = "";
   document.frm.submit();
}

function updatepair()
{
   document.frm.action.value="updatepair";
   document.frm.target = "";
   document.frm.submit();
}


function next_page(id)
{
   document.frm.action.value="lesson_details";
   document.frm.currentpage.value=id;
   document.frm.target = "";
   document.frm.submit();
}

function remove_movie(id)
{
   document.frm.action.value="remove_movie";
   document.frm.movieid.value=id;
   document.frm.target = "";
   document.frm.submit();
}

function prev_page(id)
{
   document.frm.action.value="lesson_details";
   document.frm.currentpage.value=id;
   document.frm.target = "";
   document.frm.submit();
}


function remove_pair(id)
{
var answer = confirm("Are you sure you want to remove this pair?")
    if (answer){
   document.frm.action.value="removepair";
   document.frm.pair.value=id;
   document.frm.target = "";
   document.frm.submit();
    }
}

function edit_pair(id)
{
   document.frm.action.value="editpair";
   document.frm.pair.value=id;
   document.frm.target = "";
   document.frm.submit();
}


function new_page()
{
   document.frm.action.value="new_page";
   document.frm.target = "";
   document.frm.submit();
}
function insert_new_page(id)
{
   document.frm.action.value="insert_new_page";
   document.frm.newpage.value=id;
   document.frm.currentpage.value=id;
   document.frm.target = "";
   document.frm.submit();
}

function submit_new_lesson()
{
   document.frm.action.value="submit_new_lesson";
   document.frm.target = "";
   document.frm.submit();
}

function serials_details(id)
{
   document.frm.action.value="serials_details";
   document.frm.sid.value=id;
   document.frm.target = "";
   document.frm.submit();
}
function generate_serials()
{
   document.frm.action.value="generate_serials";
   document.frm.target = "";
   document.frm.submit();
}
function delete_serials()
{
   document.frm.action.value="delete_serials";
   document.frm.target = "";
   document.frm.submit();
	
}	
function lock_selected_serials()
{
   document.frm.action.value="lock_selected_serials";
   document.frm.target = "";
   document.frm.submit();
}	
function unlock_selected_serials()
{
   document.frm.action.value="unlock_selected_serials";
   document.frm.target = "";
   document.frm.submit();
}	
function dismiss()
{
   document.frm.action.value="dismiss";
   document.frm.target = "";
   document.frm.submit();
}
	
function unlock_selected_serial()
{
   document.frm.action.value="unlock_selected_serial";
   document.frm.target = "";
   document.frm.submit();
}	

	
function settings_customersportals()
{
   document.frm.action.value="settings_customersportals";
   document.frm.target = "";
   document.frm.submit();
}	
function settings_companyprofile()
{
   document.frm.action.value="settings_companyprofile";
   document.frm.target = "";
   document.frm.submit();
}	
function settings_addportal()
{
   document.frm.action.value="settings_addportal";
   document.frm.target = "";
   document.frm.submit();
}
function submit_new_customerportal()
{
   document.frm.action.value="submit_new_customerportal";
   document.frm.target = "";
   document.frm.submit();
}	

function submit_new_taxcode()
{
   document.frm.action.value="submit_new_taxcode";
   document.frm.target = "";
   document.frm.submit();
}	
function submit_update_taxcode()
{
   document.frm.action.value="submit_update_taxcode";
   document.frm.target = "";
   document.frm.submit();
}	

function settings_removeportal(uu)
{
var answer = confirm("Are you sure you want to remove this customer portal?")
    if (answer){
   document.frm.action.value="settings_removeportal";
   document.frm.uid.value = uu;
   document.frm.target = "";
   document.frm.submit();
	   }
}	
function addcompanyuser	()
{
   document.frm.action.value="addcompanyuser";
   document.frm.target = "";
   document.frm.submit();

}
	
function addcustomeruser()
{
   document.frm.action.value="addcustomeruser";
   document.frm.target = "";
   document.frm.submit();
}
function settings_permissions()
{
   document.frm.action.value="settings_permissions";
   document.frm.target = "";
   document.frm.submit();
}

function settings_customersusers()
{
   document.frm.action.value="settings_customersusers";
   document.frm.target = "";
   document.frm.submit();
}


function settings_editprofile()
{
   document.frm.action.value="settings_editprofile";
   document.frm.target = "";
   document.frm.submit();
}

// function settings_edituser(uu)
// {
//    document.frm.action.value="settings_edituser";
//    document.frm.uid.value = uu;
//    document.frm.target = "";
//    document.frm.submit();
// }
function removeCompanyUser(uu)
{
var answer = confirm("Are you sure you want to remove this user?")
    if (answer){
   document.frm.action.value="settings_removeuser";
   document.frm.uid.value = uu;
   document.frm.target = "";
   document.frm.submit();
    }
}

function settings_edit_taxcode(uu)
{
   document.frm.action.value="settings_edit_taxcode";
   document.frm.cid.value = uu;
   document.frm.target = "";
   document.frm.submit();
}


function settings_edit_customeruser(uu)
{
   document.frm.action.value="settings_edit_customeruser";
   document.frm.uid.value = uu;
   document.frm.target = "";
   document.frm.submit();
}
function settings_delete_customeruser(uu)
{
var answer = confirm("Are you sure you want to remove this user?")
    if (answer){
   document.frm.action.value="settings_delete_customeruser";
   document.frm.uid.value = uu;
   document.frm.target = "";
   document.frm.submit();
    }
}

function settings_userslist()
{
   document.frm.action.value="settings_userslist";
   document.frm.target = "";
   document.frm.submit();
}
function submit_update_myprofile()
{
   document.frm.action.value="submit_update_myprofile";
   document.frm.target = "";
   document.frm.submit();
}

function submit_update_companyprofile()
{
   document.frm.action.value="submit_update_companyprofile";
   document.frm.target = "";
   document.frm.submit();
}	
function submit_new_settingsuser()
{
   document.frm.action.value="submit_new_settingsuser";
   document.frm.target = "";
   document.frm.submit();
}	
function submit_update_settingsuser()
{
   document.frm.action.value="submit_update_settingsuser";
   document.frm.target = "";
   document.frm.submit();
}

function submit_update_customeruser()
{
   document.frm.action.value="submit_update_customeruser";
   document.frm.target = "";
   document.frm.submit();
}

	
function submit_new_customeruser()
{
   document.frm.action.value="submit_new_customeruser";
   document.frm.target = "";
   document.frm.submit();
}

	
function submit_update_permissions()
{
   document.frm.action.value="submit_update_permissions";
   document.frm.target = "";
   document.frm.submit();
}	

function menu_customers()
{
   document.frm.action.value="customers";
//   document.getElementById("page").value="";
//   document.frm.page.value="";
//   document.frm.filter.value="";
//   document.frm.search.value="";
   document.frm.target = "";
   document.frm.submit();
}
function customer_list()
{
   document.frm.action.value="customers";
   document.frm.target = "";
   document.frm.submit();
}

function locations()
{
   document.frm.action.value="locations";
   document.frm.target = "";
   document.frm.submit();
}
function edit_location(ccid)
{
   document.frm.action.value="edit_location";
   document.frm.lid.value = ccid;
   document.frm.target = "";
   document.frm.submit();
}
function new_location()
{
   document.frm.action.value="new_location";
   document.frm.target = "";
   document.frm.submit();
}

function new_appointment()
{
   document.frm.action.value="new_appointment";
   document.frm.target = "";
   document.frm.submit();
}

function new_pappointment(uid)
{
   document.frm.action.value="new_appointment";
   document.frm.sid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}

function addLabor(uid)
{
   document.frm.action.value="addlabor";
   document.frm.sid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}
function addMaterial(uid)
{
   document.frm.action.value="addmaterial";
   document.frm.sid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}
function addExpenses(uid)
{
   document.frm.action.value="addexpenses";
   document.frm.sid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}


function new_reminder()
{
   document.frm.action.value="new_reminder";
   document.frm.target = "";
   document.frm.submit();
}


function cancel_update_location(ccid)
{
   document.frm.action.value="locations";
   document.frm.target = "";
   document.frm.submit();
}	

function menu_courses()
{
   document.frm.action.value="courses";
   document.frm.target = "";
   document.frm.submit();
}

function list_courses()
{
   document.frm.action.value="courses";
   document.frm.target = "";
   document.frm.submit();
}
function list_portal_service_request()
{
   document.frm.action.value="list_portal_service_request";
   document.frm.target = "";
   document.frm.submit();
}

function portal_newservicerequest()
{
   document.frm.action.value="portal_newservicerequest";
   document.frm.target = "";
   document.frm.submit();
}


function search_portal_service_request()
{
   document.frm.action.value="list_portal_service_request";
   document.frm.page.value="1";
   document.frm.target = "";
   document.frm.submit();
}


function item_list()
{
   document.frm.action.value="item_list";
   document.frm.target = "";
   document.frm.submit();
}
function newLabor()
{
   document.frm.action.value="newlabor";
   document.frm.target = "";
   document.frm.submit();
}
function newMaterial()
{
   document.frm.action.value="newmaterial";
   document.frm.target = "";
   document.frm.submit();
}
function newExpense()
{
   document.frm.action.value="newexpense";
   document.frm.target = "";
   document.frm.submit();
}


function list_serviceRequest()
{
   document.frm.action.value="billing";
   document.frm.target = "";
   document.frm.submit();
}


function next_servicerequest()
{
   document.frm.action.value="service_request";
   document.frm.page.value = document.frm.page.value-0+1;
   document.frm.target = "";
   document.frm.submit();
}	
function prev_servicerequest()
{
   document.frm.action.value="service_request";
   document.frm.page.value = document.frm.page.value-0-1;
   document.frm.target = "";
   document.frm.submit();
}	
function page_servicerequest(pg)
{
   document.frm.action.value="service_request";
   document.frm.page.value = pg;
   document.frm.target = "";
   document.frm.submit();
}

function page_portal_servicerequest(pg)
{
   document.frm.action.value="list_portal_service_request";
   document.frm.page.value = pg;
   document.frm.target = "";
   document.frm.submit();
}
function next_portal_servicerequest()
{
   document.frm.action.value="list_portal_service_request";
   document.frm.page.value = document.frm.page.value-0+1;
   document.frm.target = "";
   document.frm.submit();
}	
function prev_portal_servicerequest()
{
   document.frm.action.value="list_portal_service_request";
   document.frm.page.value = document.frm.page.value-0-1;
   document.frm.target = "";
   document.frm.submit();
}	


function next_contact()
{
   document.frm.action.value="contact_list";
   document.frm.page.value = document.frm.page.value-0+1;
   document.frm.target = "";
   document.frm.submit();
}	
function prev_contact()
{
   document.frm.action.value="contact_list";
   document.frm.page.value = document.frm.page.value-0-1;
   document.frm.target = "";
   document.frm.submit();
}	
function page_contact(ug)
{
   document.frm.action.value="contact_list";
   document.frm.page.value = ug;
   document.frm.target = "";
   document.frm.submit();
}	


function new_course()
{
   document.frm.action.value="new_course";
   document.frm.target = "";
   document.frm.submit();
}

function servicerequest_list()
{
   document.frm.action.value="service_request";
   document.frm.target = "";
   document.frm.submit();
}	

function menu_scheduling()
{
   document.frm.action.value="scheduling";
   document.frm.target = "";
   document.frm.submit();
}
function menu_contracts()
{
   document.frm.action.value="contracts";
//   document.frm.status.value="1";
   document.frm.target = "";
   document.frm.submit();
}

function fresh_contracts()
{
   document.frm.action.value="contracts";
   document.frm.status.value="1";
   document.frm.target = "";
   document.frm.submit();
}	

function contracts()
{
   document.frm.action.value="contracts";
   document.frm.target = "";
   document.frm.submit();
}	


function menu_billing()
{
   document.frm.action.value="billing";
   document.frm.target = "";
   document.frm.submit();
}
function menu_time()
{
   document.frm.action.value="time";
   document.frm.target = "";
   document.frm.submit();
}
function menu_help()
{
//    document.frm.action.value="help";
//    document.frm.target = "";
//    document.frm.submit();
}
function menu_contactus()
{
   document.frm.action.value="contactus";
   document.frm.target = "";
   document.frm.submit();
}
function logout()
{
   document.frm.action.value="logout";
   document.frm.target = "";
   document.frm.submit();
}
function portal_logout()
{
   document.frm.action.value="portal_logout";
   document.frm.target = "";
   document.frm.submit();
}

function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   document.frm.action.value="login";
   document.frm.target = "";
   document.frm.submit();
   return false;
   }
else
   return true;
}

function new_customer()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="new_customer";
   document.frm.target = "";
   document.frm.submit();
}


function new_contract()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="new_contract";
   document.frm.target = "";
   document.frm.submit();
}

function submit_new_customer()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="submit_new_customer";
   document.frm.target = "";
   document.frm.submit();
}
function submit_add_labor()
{
   document.frm.action.value="submit_add_labor";
   document.frm.target = "";
   document.frm.submit();
}	

function submit_add_material()
{
   document.frm.action.value="submit_add_material";
   document.frm.target = "";
   document.frm.submit();
}

function submit_add_expenses()
{
   document.frm.action.value="submit_add_expenses";
   document.frm.target = "";
   document.frm.submit();
}


function submit_new_labor()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="submit_new_labor";
   document.frm.target = "";
   document.frm.submit();
}
function submit_new_material()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="submit_new_material";
   document.frm.target = "";
   document.frm.submit();
}

function submit_new_expense()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="submit_new_expense";
   document.frm.target = "";
   document.frm.submit();
}

function submit_new_contract()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="submit_new_contract";
   document.frm.target = "";
   document.frm.submit();
}


function submit_new_course()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="submit_new_course";
   document.frm.target = "";
   document.frm.submit();
}
function submit_new_portal_servicerequest()
{
   document.frm.action.value="submit_new_portal_servicerequest";
   document.frm.target = "";
   document.frm.submit();
}	



function contact_list()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="contact_list";
   document.frm.target = "";
   document.frm.submit();
}

function submit_update_customer()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="submit_update_customer";
   document.frm.target = "";
   document.frm.submit();
}

function submit_update_item()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="submit_update_item";
   document.frm.target = "";
   document.frm.submit();
}


function submit_update_contract()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="submit_update_contract";
   document.frm.target = "";
   document.frm.submit();
}
function submit_update_course()
{
   document.frm.action.value="submit_update_course";
   document.frm.target = "";
   document.frm.submit();
}	

function submit_update_lesson()
{
   document.frm.action.value="submit_update_lesson";
   document.frm.target = "";
   document.frm.submit();
}	

function submit_update_location()
{
   document.frm.action.value="submit_update_location";
   document.frm.target = "";
   document.frm.submit();
}	
function submit_new_location()
{
   document.frm.action.value="submit_new_location";
   document.frm.target = "";
   document.frm.submit();
}	


function customers(flt)
{
   document.frm.action.value="customers";
   document.frm.filter.value=flt;
   document.frm.page.value = "";
   document.frm.target = "";
   document.frm.submit();
}	

function calendar(flt)
{
   document.frm.action.value="calendar";
   document.frm.option.value=flt;
   document.frm.target = "";
   document.frm.submit();
}	

function day(year,month,day)
{
   document.frm.action.value="calendar";
   document.frm.cyear.value = year;
   document.frm.cmonth.value = month;
   document.frm.cday.value = day;
   document.frm.option.value=0;
   document.frm.target = "";
   document.frm.submit();
}	
function weekavtocal(year,month,day)
{
   document.frm.action.value="calendar";
   document.frm.cyear.value = year;
   document.frm.cmonth.value = month;
   document.frm.cday.value = day;
   document.frm.option.value=0;
   document.frm.target = "";
   document.frm.submit();
}	


function search_customers()
{
   document.frm.action.value="customers";
   document.frm.target = "";
   document.frm.submit();
}	


function next_customer()
{
   document.frm.action.value="customers";
   document.frm.page.value = document.frm.page.value-0+1;
   document.frm.target = "";
   document.frm.submit();
}	
function prev_customer()
{
   document.frm.action.value="customers";
   document.frm.page.value = document.frm.page.value-0-1;
   document.frm.target = "";
   document.frm.submit();
}	

function page_customer(pg)
{
   document.frm.action.value="customers";
   document.frm.page.value = pg;
   document.frm.target = "";
   document.frm.submit();
}	


function next_contract()
{
   document.frm.action.value="contracts";
   document.frm.page.value = document.frm.page.value-0+1;
   document.frm.target = "";
   document.frm.submit();
}	
function prev_contract()
{
   document.frm.action.value="contracts";
   document.frm.page.value = document.frm.page.value-0-1;
   document.frm.target = "";
   document.frm.submit();
}	


function contacts(flt)
{
   document.frm.action.value="contact_list";
   document.frm.filter.value=flt;
   document.frm.target = "";
   document.frm.submit();
}	


function lessons(id)
{
   document.frm.action.value="lessons";
   document.frm.sid.value=id;
   document.frm.target = "";
   document.frm.submit();
}	
function lesson_details(id)
{
   document.frm.action.value="lesson_details";
   document.frm.lid.value=id;
   document.frm.target = "";
   document.frm.submit();
}	
function language_lesson_details(id)
{
   document.frm.action.value="lesson_details";
   document.frm.lid.value=id;
   document.frm.sourcelanguage.value = document.frm.multilanguage.value;
   document.frm.target = "";
   document.frm.submit();
}

	
function edit_course(id)
{
   document.frm.action.value="edit_course";
   document.frm.sid.value=id;
   document.frm.target = "";
   document.frm.submit();
}	

function save_course(id)
{
   document.frm.action.value="save_course";
   document.frm.sid.value=id;
   document.frm.target = "";
   document.frm.submit();
}	


function edit_lesson(id)
{
   document.frm.action.value="edit_lesson";
   document.frm.lid.value=id;
   document.frm.target = "";
   document.frm.submit();
}	

function remove_lesson(id)
{
var answer = confirm("Are you sure you want to remove this lesson?")
    if (answer){
   document.frm.action.value="remove_lesson";
   document.frm.lid.value=id;
   document.frm.target = "";
   document.frm.submit();
    }
}	
function remove_page(id)
{
var answer = confirm("Are you sure you want to remove this page?")
    if (answer){
   document.frm.action.value="remove_page";
   document.frm.removepage.value=id;
   document.frm.target = "";
   document.frm.submit();
    }
}	


function pair_move_up(id)
{
   document.frm.action.value="pair_move_up";
   document.frm.position.value=id;
   document.frm.target = "";
   document.frm.submit();
}	

function pair_move_down(id)
{
   document.frm.action.value="pair_move_down";
   document.frm.position.value=id;
   document.frm.target = "";
   document.frm.submit();
}	

function move_up(id)
{
   document.frm.action.value="move_up";
   document.frm.lid.value=id;
   document.frm.target = "";
   document.frm.submit();
}	

function move_down(id)
{
   document.frm.action.value="move_down";
   document.frm.lid.value=id;
   document.frm.target = "";
   document.frm.submit();
}	

function edit_contact(id)
{
   document.frm.action.value="edit_contact";
   document.frm.cid.value=id;
   document.frm.target = "";
   document.frm.submit();
}	
function preview_contact(gg)
{
   document.frm.action.value="preview_contact";
   document.frm.lid.value=gg;
   document.frm.submit();
}	



function remove_customer(id)
{
var answer = confirm("Are you sure you want to remove this customer?")
    if (answer){
   document.frm.action.value="remove_customer";
   document.frm.cid.value=id;
   document.frm.target = "";
   document.frm.submit();
    }
}	
function publish_course(id){
var answer = confirm("Are you sure you want to publish this course?")
    if (answer){
   document.frm.action.value="publish_course";
   document.frm.sid.value=id;
   document.frm.target = "";
   document.frm.submit();
    }
}	

function remove_course(id)
{
var answer = confirm("Are you sure you want to remove this course?")
    if (answer){
   document.frm.action.value="remove_course";
   document.frm.sid.value=id;
   document.frm.target = "";
   document.frm.submit();
    }
}	

function remove_location(id)
{
var answer = confirm("Are you sure you want to remove this location?")
    if (answer){
   document.frm.action.value="remove_location";
   document.frm.lid.value=id;
   document.frm.target = "";
   document.frm.submit();
    }
}	

function remove_contact(id)
{
var answer = confirm("Are you sure you want to remove this contact?")
    if (answer){
   document.frm.action.value="remove_contact";
   document.frm.lid.value=id;
   document.frm.target = "";
   document.frm.submit();
    }
}	

function remove_item(id)
{
var answer = confirm("Are you sure you want to remove this item?")
    if (answer){
   document.frm.action.value="remove_item";
   document.frm.sid.value=id;
   document.frm.target = "";
   document.frm.submit();
    }
}	

function remove_serviceitem(id)
{
var answer = confirm("Are you sure you want to remove this service item?")
    if (answer){
   document.frm.action.value="remove_serviceitem";
   document.frm.rid.value=id;
   document.frm.target = "";
   document.frm.submit();
    }
}	



function toggleDiv(id,flagit) {
if (flagit=="1"){
if (document.layers) document.layers[''+id+''].visibility = "show"
else if (document.all) document.all[''+id+''].style.visibility = "visible"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
}
else
if (flagit=="0"){
if (document.layers) document.layers[''+id+''].visibility = "hide"
else if (document.all) document.all[''+id+''].style.visibility = "hidden"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
}
}


function showHelp(){
// alert('in here' + tempX);
document.getElementById('help').style.top=tempY;
document.getElementById('help').style.left=tempX;
document.getElementById('help').style.display="block";
}


function hideHelp(){
document.getElementById('help').style.display="none";
}



function fillContacts(cnts)
{
var len, i;
var str = "aaa";
    len = document.frm.contacts.options.length - 1;
    for (i=0; i<len;i++)
    {
    	document.frm.contacts.options[0] = null;
    }	
str = ""+cnts;
var contacts_pair = str.split(";");
var conts;
for (i=0;i<contacts_pair.length-1;i++)
{
	var xx = ""+contacts_pair[i];
	conts = xx.split(",");
	document.frm.contacts.options[i] = new Option(conts[1],conts[0]);
}	
if (contacts_pair.length > 1){
document.frm.contacts.options[1].selected = true;
}	

}





function fillLocations(cnts)
{
var len, i;
var str = "aaa";
    len = document.frm.locations.options.length - 1;
    for (i=0; i<len;i++)
    {
    	document.frm.locations.options[0] = null;
    }	
str = ""+cnts;
var contacts_pair = str.split(";");
var conts;
for (i=0;i<contacts_pair.length-1;i++)
{
	var xx = ""+contacts_pair[i];
	conts = xx.split(",");
	document.frm.locations.options[i] = new Option(conts[1],conts[0]);
}	
if (contacts_pair.length > 1){
document.frm.locations.options[1].selected = true;
}	
}

function fillBillto(cnts)
{
var len, i;
var str = "aaa";
    len = document.frm.billto.options.length - 1;
    for (i=0; i<len;i++)
    {
    	document.frm.billto.options[0] = null;
    }	
str = ""+cnts;
var contacts_pair = str.split(";");
var conts;
for (i=0;i<contacts_pair.length-1;i++)
{
	var xx = ""+contacts_pair[i];
	conts = xx.split(",");
	document.frm.billto.options[i] = new Option(conts[1],conts[0]);
}	
if (contacts_pair.length > 1){
document.frm.billto.options[1].selected = true;
}	
}



function fillContracts(cnts)
{
var len, i;
var str = "aaa";
    len = document.frm.contract.options.length - 1;
    for (i=0; i<len;i++)
    {
    	document.frm.contract.options[0] = null;
    }	
str = ""+cnts;
var contacts_pair = str.split(";");
var conts;
for (i=0;i<contacts_pair.length-1;i++)
{
	var xx = ""+contacts_pair[i];
	conts = xx.split(",");
	document.frm.contract.options[i] = new Option(conts[1],conts[0]);
}	
if (contacts_pair.length > 1){
document.frm.contract.options[1].selected = true;
}	
}


function ShowHiddenElements() {
	var chk;
// 	chk = $("chkAssignToMoreUsers");
// 	if (chk != null)
// 		if (chk.checked) {$('divAssignToMoreUsers').show()} else {$('divAssignToMoreUsers').hide()};
// 	
	chk = document.frm.chkScheduled;
	if (chk != null)
	{
	    if (chk.checked) {
	        document.getElementById("scheduled").style.visibility = "visible";
	        document.getElementById("scheduled").style.display = "";
	    } 
	    else {
	         document.getElementById("scheduled").style.visibility = "hidden";
	        document.getElementById("scheduled").style.display = "none";
	    }
	} 

	chk = document.frm.chkDueDate;
	if (chk != null)
	{
	    if (chk.checked) {
	        document.getElementById("dueDate").style.visibility = "visible";
	        document.getElementById("dueDate").style.display = "";
	    } 
	    else {
	         document.getElementById("dueDate").style.visibility = "hidden";
	        document.getElementById("dueDate").style.display = "none";
	    }
	} 

}


function updateTaxes()
{
var stot,tax, taxv, total;
var xx = 100;
    stot = parseFloat(document.frm.subtotal.value);
    tax = parseFloat(taxlist[document.frm.taxcode.value]);
    taxv = parseFloat(0.01*stot*tax);
    total = parseFloat(stot + taxv);

    xx = parseFloat(1.00*stot);
    alert(document.frm.taxcode.value + ":" +taxlist[document.frm.taxcode.value]);
    document.frm.subtotal.value = xx.toFixed(2);
    document.frm.tax.value = taxv.toFixed(2);
    document.frm.total.value = total.toFixed(2);
}	



function handleBill()
{
	    if (document.frm.billto[1].checked) {
	        document.getElementById("otheraddress").style.visibility = "visible";
	        document.getElementById("otheraddress").style.display = "";
	    } 
	    else {
	         document.getElementById("otheraddress").style.visibility = "hidden";
	        document.getElementById("otheraddress").style.display = "none";
	    }
	    if (document.frm.billto[2].checked) {
	        document.getElementById("othercustomer").style.visibility = "visible";
	        document.getElementById("othercustomer").style.display = "";
	    } 
	    else {
	         document.getElementById("othercustomer").style.visibility = "hidden";
	        document.getElementById("othercustomer").style.display = "none";
	    }

}	



function follow(linkul,id)
{
   document.frm.action.value="follow";
   document.frm.linkul.value=linkul;
   document.frm.idul.value=id;
   document.frm.target = "_blank";
   //alert(document.frm.target);
   document.frm.submit();
   document.frm.target = "";
}

function help()
{
//   document.getElementById('action').value="help";
//   document.frm.target = "";
//   document.frm.submit();
}


function contact()
{
   document.getElementById('action').value="contact";
   document.frm.target = "";
   document.frm.submit();
}

var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
function encode64(input) {
   if(input == '') return '';
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   do {
      chr1 = input.charCodeAt(i++);
      chr2 = input.charCodeAt(i++);
      chr3 = input.charCodeAt(i++);

      enc1 = chr1 >> 2;
      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
      enc4 = chr3 & 63;

      if (isNaN(chr2)) {
         enc3 = enc4 = 64;
      } else if (isNaN(chr3)) {
         enc4 = 64;
      }

      output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) +
         keyStr.charAt(enc3) + keyStr.charAt(enc4);
   } while (i < input.length);

   return output;
}
function decode64(input) {
   if(input == '') return '';
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

   do {
      enc1 = keyStr.indexOf(input.charAt(i++));
      enc2 = keyStr.indexOf(input.charAt(i++));
      enc3 = keyStr.indexOf(input.charAt(i++));
      enc4 = keyStr.indexOf(input.charAt(i++));

      chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;

      output = output + String.fromCharCode(chr1);

      if (enc3 != 64) {
         output = output + String.fromCharCode(chr2);
      }
      if (enc4 != 64) {
         output = output + String.fromCharCode(chr3);
      }
   } while (i < input.length);

   return output;
}



function fillCustomerLocations(cnts)
{
var len, i;
var str = "aaa";
document.all("locationdescription").innerHTML = "";
    len = document.frm.bcustomerlocation.options.length - 1;
    for (i=0; i<len;i++)
    {
    	document.frm.bcustomerlocation.options[0] = null;
    }	
str = ""+cnts;
var contacts_pair = str.split(";");
var conts;
for (i=0;i<contacts_pair.length-1;i++)
{
	var xx = ""+contacts_pair[i];
	conts = xx.split(",");
	document.frm.bcustomerlocation.options[i] = new Option(conts[1],conts[0]);
}	
if (contacts_pair.length > 1){
document.frm.bcustomerlocation.options[1].selected = true;
}	
getLocationDescription();
}



function equipments()
{
   document.frm.action.value="equipments";
   document.frm.target = "";
   document.frm.submit();
}
function new_equipment()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="new_equipment";
   document.frm.target = "";
   document.frm.submit();
}

function submit_new_equipment()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="submit_new_equipment";
   document.frm.target = "";
   document.frm.submit();
}

function submit_update_equipment()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="submit_update_equipment";
   document.frm.target = "";
   document.frm.submit();
}

function edit_equipment(ccid)
{
   document.frm.action.value="edit_equipment";
   document.frm.lid.value = ccid;
   document.frm.target = "";
   document.frm.submit();
}

function import_customers()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="ic1";
   document.frm.target = "";
   document.frm.submit();
}

function submit_ic1()
{
   document.frm.action.value="ic2";
   document.frm.target = "";
   document.frm.submit();
}	

function submit_ic2()
{
   document.frm.action.value="ic3";
   document.frm.target = "";
   document.frm.submit();
}	

function viewSchedule(uid)
{
   document.frm.action.value="viewschedule";
   document.frm.target = "_blank";
   document.frm.submit();	
}	

function addContact()
{
var csc;
if ( document.frm.assignedto.value != "-1" ) {
csc = document.frm.cusers.value
    if ( csc.search(","+document.frm.assignedto.value+",") == -1 ){
    var now = new Date()
    var nowData = now.getHours()+now.getMinutes()+now.getSeconds()+now.getMilliseconds()
    var newCell
    var newRow = document.getElementById("assigntotable").insertRow(-1)
    	newRow.id = nowData;
        newCell = newRow.insertCell(0)
        newCell.innerHTML = "<font size=\"2\" face=\"Arial\">"+document.frm.assignedto.options[document.frm.assignedto.selectedIndex].text+"</font>"
        newCell = newRow.insertCell(1)
        newCell.innerHTML = "<span class=\"cunder\"><a href=\"javascript:viewSchedule("+document.frm.assignedto.value+")\"><font size=\"2\" face=\"Arial\" color=black>View schedule</font></a></span>"
        newCell = newRow.insertCell(2)
        newCell.innerHTML = "<span class=\"cunder\"><a href=\"javascript:removeContact("+nowData+","+document.frm.assignedto.value+")\"><font size=\"2\" face=\"Arial\" color=black>Remove</font></a></span>"




    newRow = document.getElementById("assigntotable").insertRow(-1);
        newCell = newRow.insertCell(0)
        newCell.colSpan = 3;
        newCell.innerHTML = "<hr>"
document.frm.cusers.value += document.frm.assignedto.value+",";
    }
    else
    {
    	alert("The user is already in the list")
    }
}    	
}	

function removeContact(x,y)
{
    var ri;
    var lll;
    var csc;
    ri = document.getElementById(x).rowIndex
    document.getElementById("assigntotable").deleteRow(ri)
    document.getElementById("assigntotable").deleteRow(ri)
    csc = document.frm.cusers.value
//    alert(csc)
//    alert(","+y+",")
    csc = csc.replace(","+y+",",",")
//    alert(csc)
    document.frm.cusers.value = csc
}	

// 			window.onresize = function() { checkPage("ScrollBox",page_elements);}
// 			document.oncontextmenu = document.onselectstart = function () { return false; }
// 			window.onload = function () {
// 				checkPage("ScrollBox",page_elements);
// 				status = document.getElementById("status");
// 				createFileInput(path);
// 			}	
function submit_new_appointment()
{
   document.frm.action.value="submit_new_appointment";
   document.frm.target = "";
   document.frm.submit();
}
function submit_new_reminder()
{
   document.frm.action.value="submit_new_reminder";
   document.frm.target = "";
   document.frm.submit();
}



function removeReminder(uid)
{
var answer = confirm("Are you sure you want to remove this reminder?")
    if (answer){
   document.frm.action.value="removereminder";
   document.frm.rid.value=uid;
   document.frm.target = "";
   document.frm.submit();
   }
}

function preview_reminder(uid)
{
   document.frm.action.value="preview_reminder";
   document.frm.rid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}	
function preview_item(uid)
{
   document.frm.action.value="preview_item";
   document.frm.sid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}	

function preview_location(ccid)
{
   document.frm.action.value="preview_location";
   document.frm.lid.value = ccid;
   document.frm.target = "";
   document.frm.submit();
}


function preview_serviceitem(uid)
{
   document.frm.action.value="preview_serviceitem";
   document.frm.rid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}	


function preview_contract(uid)
{
   document.frm.action.value="preview_contract";
   document.frm.contractid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}	
function preview_servicerequest(uid)
{
   document.frm.action.value="preview_servicerequest";
   document.frm.sid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}	

function preview_portal_servicerequest(uid)
{
   document.frm.action.value="preview_portal_servicerequest";
   document.frm.sid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}	


function preview_appointment(uid)
{
   document.frm.action.value="preview_appointment";
   document.frm.rid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}	

function preview_customer(uid)
{
   document.frm.action.value="preview_customer";
   document.frm.cid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}	


function print_appointment(uid)
{
   document.frm.action.value="print_appointment";
   document.frm.rid.value=uid;
   document.frm.target = "_blank";
   document.frm.submit();
}	

function print_workorder()
{
   document.frm.action.value="print_workorder";
   document.frm.target = "_blank";
   document.frm.submit();
}	
function print_schedule()
{
   document.frm.action.value="print_schedule";
   document.frm.target = "_blank";
   document.frm.submit();
}	


function print_servicerequesthistory()
{
   document.frm.action.value="print_servicerequesthistory";
   document.frm.target = "_blank";
   document.frm.submit();
}	

function print_servicerequest(uid)
{
   document.frm.action.value="print_servicerequest";
   document.frm.sid.value=uid;
   document.frm.target = "_blank";
   document.frm.submit();
}	

function invoice_servicerequest(uid)
{
   document.frm.action.value="inv_servicerequest";
   document.frm.sid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}	

function invoice_servicerequest1(uid)
{
   document.frm.action.value="inv_servicerequest1";
   document.frm.sid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}	

function iinvoice_servicerequest(uid)
{
   document.frm.action.value="invoice_servicerequest";
   document.frm.sid.value=uid;
   document.frm.target = "_blank";
   document.frm.submit();
}	

function edit_reminder(uid)
{
   document.frm.action.value="edit_reminder";
   document.frm.rid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}	

function edit_item(uid)
{
   document.frm.action.value="edit_item";
   document.frm.sid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}	

function edit_serviceitem(uid)
{
   document.frm.action.value="edit_serviceitem";
   document.frm.rid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}	

function submit_update_serviceitem()
{
   document.frm.action.value="submit_update_serviceitem";
   document.frm.target = "";
   document.frm.submit();
}	


function removeAppointment(uid)
{
var answer = confirm("Are you sure you want to remove this appointment?")
    if (answer){
   document.frm.action.value="removeappointment";
   document.frm.rid.value=uid;
   document.frm.target = "";
   document.frm.submit();
   }
}

function removeContract(uid)
{
var answer = confirm("Are you sure you want to remove this contract?")
    if (answer){
   document.frm.action.value="removecontract";
   document.frm.contractid.value=uid;
   document.frm.target = "";
   document.frm.submit();
   }
}

function removeTaxcode(uid)
{
var answer = confirm("Are you sure you want to remove this tax code?")
    if (answer){
   document.frm.action.value="removetaxcode";
   document.frm.cid.value=uid;
   document.frm.target = "";
   document.frm.submit();
   }
}



function editAppointment(uid)
{
   document.frm.action.value="editappointment";
   document.frm.rid.value=uid;
   document.frm.target = "";
   document.frm.submit();
}	
function submit_update_appointment()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="submit_update_appointment";
   document.frm.target = "";
   document.frm.submit();
}
function submit_update_reminder()
{
//   document.getElementById('action').value="new_customer";
   document.frm.action.value="submit_update_reminder";
   document.frm.target = "";
   document.frm.submit();
}

function exportBilling()
{
   document.frm.action.value="exportbilling";
   document.frm.target = "";
   document.frm.submit();
}	

function exportNow()
{
   document.frm.action.value="downloadxml";
   document.frm.target = "_blank";
   document.frm.submit();
}	

function checkAll(chk)
{
if(document.frm.chkAll.checked==true){
for (i = 0; i < chk.length; i++)
chk[i].checked = true ;
}else{

for (i = 0; i < chk.length; i++)
chk[i].checked = false ;
}	
}	

function formatCurrency(field)
{
	var nr = 100;
	nr = 1*field.value;
	field.value = nr.toFixed(2)
}	

function completeFields()
{
 var pph = 1 * document.frm.price.value;
 var cph = 1 * document.frm.cost.value;
 var hours = 1 * document.frm.dhour.value;
 var minutes = 1 * document.frm.dminutes.value;
 
 var totp = pph * ( hours + minutes/60 );
 var totc = cph * ( hours + minutes/60 );
 document.frm.totalprice.value = totp.toFixed(2);
 document.frm.totalcost.value = totc.toFixed(2);
 if ( document.frm.billingstatus.value == 0 )
 {
 	document.frm.totalbillable.value = totp.toFixed(2);
 }
 else
 {
 	document.frm.totalbillable.value = "0.00";
 }	

}	

function completeFields1()
{
 var pph = 1 * document.frm.price.value;
 var cph = 1 * document.frm.cost.value;
 var quantity = 1 * document.frm.quantity.value;
 
 var totp = pph * quantity;
 var totc = cph * quantity;
 document.frm.totalprice.value = totp.toFixed(2);
 document.frm.totalcost.value = totc.toFixed(2);
 if ( document.frm.billingstatus.value == 0 )
 {
 	document.frm.totalbillable.value = totp.toFixed(2);
 }
 else
 {
 	document.frm.totalbillable.value = "0.00";
 }	

}	






function editCompleteFields()
{
 var pph = 1 * document.frm.price.value;
 var cph = 1 * document.frm.cost.value;
 var totp;
 var totc;
 var quantity;
 if ( document.frm.tip.value == 3 ){
	quantity = 1 * document.frm.quantity.value;
	totp = pph * quantity;
	totc = cph * quantity;
 }
 else
 {
	hours = 1 * document.frm.dhour.value;
	minutes = 1 * document.frm.dminutes.value;
	
	totp = pph * ( hours + minutes/60 );
	totc = cph * ( hours + minutes/60 );
 }	
 
 document.frm.totalprice.value = totp.toFixed(2);
 document.frm.totalcost.value = totc.toFixed(2);
 if ( document.frm.billingstatus.value == 0 )
 {
 	document.frm.totalbillable.value = totp.toFixed(2);
 }
 else
 {
 	document.frm.totalbillable.value = "0.00";
 }	

}	

function portal_login()
{
   document.frm.action.value="portal_submitlogin";
   document.frm.target = "";
   document.frm.submit();
}
function portal_logout()
{
   document.frm.action.value="portal_logout";
   document.frm.target = "";
   document.frm.submit();
}




