function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
	window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}


function addNifty() {
  Nifty("#container-login","big");
  Nifty("#container-quick-search","big");
  Nifty("#container-reg","big");
}
/*
addLoadEvent(addNifty);
*/

function set_form_action(action)
  {
	f=document.postAD;
	f.form_action.value=action;
	f.submit();
	return false;
  }
  
function delete_directory_entry(eid) {

  if (confirm('Are you sure you want to delete this entry?\nPlease Note: It will be permanently deleted.'))
  {
	document.directoryEntryDelete.entry_id.value=eid;
	document.directoryEntryDelete.submit();
	return false;
  } else {
	return false;
  }
}
 

function toggleChecked(oElement) 
  { 
	oForm = oElement.form; 
	oElement = oForm.elements[oElement.name]; 
	  if(oElement.length) 
	  { 
		bChecked = oElement[0].checked; 
		  for(i = 1; i < oElement.length; i++) 
			oElement[i].checked = bChecked; 
	  } 
  } 
      

function send_unfilled()
  {
	f=document.multipleEntOld;
	f.form_action.value='pos_unfilled';
	f.submit();
	return false;
  }
		 
function send_filled()
 {
	if (confirm('Are you sure you want to set as \'hidden\'?\nPlease Note: This will hide the selected listings from the site.'))
	{
	  f=document.multipleEntCurrent;
	  f.form_action.value='opp_filled';
	  f.submit();
	  return false;
	} else {
	  return false;
   }
 }  
		 
  function send_pay()
  {
	f=document.multipleEntPay;
	f.form_action.value='payForSelected';
	f.submit();
	return false;
  }
  
 function toggle( targetId ){
  if (document.getElementById){
        target = document.getElementById( targetId );
            if (target.style.display == "none"){
                target.style.display = "";
            } else {
                target.style.display = "none";
            }
    }
}

function delete_company_logo() {

  if (confirm('Are you sure you want to delete your logo?\nPlease Note: It will be permantently deleted.'))
  {
	document.dellogo.submit();
	return false;
  } else {
	return false;
  }
}

function show_faq(id) {
	$(".allfaqs").hide()
	$("#" + id).show()	
}

function hide_faq(id) {
	$("#" + id).hide()	
}

function pageNav (increment) {
	if (increment == "next") {
        document.getElementById('page_num').value++;
    } else if (increment == "prev") {
        document.getElementById('page_num').value--;
    } else {
        document.getElementById('page_num').value = increment;
    }
    
	document.getElementById('pageNavForm').submit();
	
	return false;
}

function gotoPage(pageNo) {
  f=document.pageNavForm;
  f.page_num.value=pageNo;
  f.submit();
  return false;
}
