function check_article_submit(term)	{
	if (!document.getElementById('draft').checked)	 {
		return confirm("The " + term + " you are submitting will be live once submitted, are you sure you want it to go live?\n\nIf not click the cancel button and check the 'save as draft' checkbox");
		}
	}

function get_org_data()	{
	http = getHTTPObject();

	http.onreadystatechange = function()	{
		if (http.readyState == 4) {
			fill_form(http.responseText);
			}
		}

	variables = "org_id=" + document.getElementById('org')[document.getElementById('org').selectedIndex].value;

	http.open('POST', 'functions/get_org_data.php', true);
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", variables.length);
	http.setRequestHeader("Connection", "close");
	http.send(variables);
	return false;
	}

function fill_form(JSONdata)	{
	eval(JSONdata);
	document.getElementById('add_form').style.display = 'block';

	document.getElementById('add_hdr').innerHTML = "Edit Existing Organization";

	document.getElementById('org_id').value = info.organization_id;
	document.getElementById('acronym_z').value = info.acronym;
	document.getElementById('org_name_y').value = info.orgname;
	document.getElementById('addy_1_y').value = info.address1;
	document.getElementById('addy_2_y').value = info.address2;
	document.getElementById('city_y').value = info.city;
	document.getElementById('zipcode_z').value = info.zipcode;
	document.getElementById('phone_z').value = info.phone;
	document.getElementById('fax_z').value = info.fax;
	document.getElementById('url_u').value = info.url;
	document.getElementById('contact_1_z').value = info.contact1;
	document.getElementById('email_1_e').value = info.email1;
	document.getElementById('contact_2_z').value = info.contact2;
	document.getElementById('email_2_e').value = info.email2;

	/* now to get the dropdowns refilled */

	for (var x = 0; x < document.getElementById('state_z').options.length ; x++)	 {

		if (document.getElementById('state_z')[x].value == info.statecode)	{
			document.getElementById('state_z').selectedIndex = x;
			}
		}

	for (var x = 0; x < document.getElementById('country_z').options.length ; x++)	 {

		if (document.getElementById('country_z')[x].value == info.countrycode)	{
			document.getElementById('country_z').selectedIndex = x;
			}
		}

	document.getElementById('e_button').value = "submit edited information";

	if (document.getElementById('o_edited'))	 {
		document.getElementById('o_edited').innerHTML = '';
		}

	}

function generic_open_close(id, linktext)	{
	if (document.getElementById(id).style.display == 'none')	{
		document.getElementById(id).style.display = 'block';
		document.getElementById('linktext').innerHTML = 'close ' + linktext;
		}
	else	{
		document.getElementById(id).style.display = 'none';
		document.getElementById('linktext').innerHTML = 'open ' + linktext;
		}
	}

function verify(name)	{
	if(document.getElementById('del_box').checked)	{
		return confirm("Are your sure you wish to delete this " + name + "?");
		}
	}

function update_edit_boxes(from)	{
	document.getElementById('edit_box').value = document.getElementById(from)[document.getElementById(from).selectedIndex].value;
	document.getElementById('del_box').value = document.getElementById(from)[document.getElementById(from).selectedIndex].value;
	}

function close_bio()	{
	
	if (document.getElementById('p_bio').style.display == 'block')	{
		
		document.getElementById('p_bio').style.display = 'none';
		
		}
	else	{
		document.getElementById('p_bio').style.display = 'block';
		}	
	}
function close_clientlist()	{

if (document.getElementById('p_client').style.display == 'block')	{
	
	document.getElementById('p_client').style.display = 'none';
	
	}
else	{
	document.getElementById('p_client').style.display = 'block';
	}	
}


function openMenu(menuName, hdrName)	{
	var lists = new Array('stylelist', 'articlelist', 'sitelist','speciallist');
	var hdrs = new Array('stylehdr', 'arthdr', 'sitehdr', 'specialhdr');

	if (document.getElementById(menuName).style.display == 'none')	 {
		document.getElementById(menuName).style.display = 'block';
		document.getElementById(hdrName).style.backgroundImage = 'url(/admin/images/header-bg.jpg)';
		}
	else	{
		document.getElementById(menuName).style.display = 'none';
		document.getElementById(hdrName).style.backgroundImage = 'url(/admin/images/header-dn.jpg)';
		}
	for (var x = 0; x < lists.length ; x++)	{
		if (lists[x] != menuName)	{
			document.getElementById(lists[x]).style.display = 'none';
			document.getElementById(hdrs[x]).style.backgroundImage = 'url(/admin/images/header-dn.jpg)';
			}
		}
	}


function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}


