	
	
	function checkall(checkboxes) {
		if(checkboxes.length != undefined) {
			for(i = 0; i < checkboxes.length; i++) {
				checkboxes[i].checked = true;
			}
		}
		else 
			checkboxes.checked = true;
	}
	
	function uncheckall(checkboxes) {
		if(checkboxes.length != undefined) {
			for(i = 0; i < checkboxes.length; i++) {
				checkboxes[i].checked = false;
			}
		}
		else 
			checkboxes.checked = false;
	}
	
	function deleteArticleItems(checkboxes,article_type) {
		var temp = document.getElementById('temp');
		
		if(confirm("Are you sure you want to delete the selected item/s?")) {
			checked = 0;
			temp.value = '';
			
			if(checkboxes.length != undefined) {
				for(i = 0; i < checkboxes.length; i++) {
					if(checkboxes[i].checked == true) {
						checked++;
							
						if(checked == 1)
							temp.value += checkboxes[i].value;
						else
							temp.value += "," + checkboxes[i].value;				
					}
										
				}
			}
			else {
				if(checkboxes.checked == true)  {
					checked++;
					temp.value += checkboxes.value;				
				}				
			}			
			
			if(checked == 0)
				alert('Nothing was selected...');
			else {
					redirect("process/deletearticle_proc.php?id=" + temp.value + "&article_type=" + article_type);
			}
		}
	}
	
	function www() {
		document.search_field.reset();
		var radio1 = document.getElementById('radio1');
		var radio2 = document.getElementById('radio2');
		var advanced = document.getElementById('advanced');
			
		radio1.checked = false;
		radio2.checked = true;
		
		advanced.style.display = 'none';
		advanced.style.position = 'relative';
		blank.style.display = 'inline';
		blank.style.position = 'relative';
	}
	function itmatters() {
		document.search_field.reset();
		var radio1 = document.getElementById('radio1');
		var radio2 = document.getElementById('radio2');
		var advanced = document.getElementById('advanced');
		var blank = document.getElementById('blank');
			
		radio1.checked = true;
		radio2.checked =  false;
			
		advanced.style.display = 'inline';
		advanced.style.position = 'relative';
		blank.style.display = 'none';
		blank.style.position = 'relative';
	}
	function search() {
		if(document.search_field.keyword.value != '' && document.search_field.keyword.value != ' ' && document.search_field.keyword.value != '  ')
			document.search_field.submit();
		else
			alert('you must enter a keyword to search...');
	}
			function bodyOnLoad() {
			
				document.addArticle.reset();
				
				var title = document.getElementById('title');
				var full_contents = document.getElementById('full_contents');
				var lead_content = document.getElementById('lead_content');
				
				title.style.background="#EEE";
				full_contents.style.background="#EEE";
				lead_content.style.background='"#EEE';
				
				document.addArticle.title.focus();
				
			}
			function resetFields() {	
				document.addArticle.reset();
				window.location.reload();
				document.addArticle.title.focus();
			}
			function saveArticle() {
				if(document.addArticle.title.value == '' || document.addArticle.title.value == ' ') {
					alert('You must specify the article TITLE FIELD');
					document.addArticle.title.focus();
				}
				else if(document.addArticle.lead_content.value == '' || document.addArticle.lead_content.value == ' ') {
					alert('You must specify the article LEAD CONTENT FIELD');
					document.addArticle.lead_content.focus();
				}
				else if(document.addArticle.full_contents.value == '' || document.addArticle.full_contents.value == ' ') {
					alert('You must specify the article FULL CONTENT FIELD');
					document.addArticle.full_contents.focus();
				}
				else
					document.addArticle.submit();
			}
			function saveDiscussion() {
				if(document.addArticle.title.value == '' || document.addArticle.title.value == ' ') {
					alert('You must specify the TITLE FIELD');
					document.addArticle.title.focus();					
				}
				else if(document.addArticle.lead_content.value == '' || document.addArticle.lead_content.value == ' ') {
					alert('You must specify the DESCRIPTION FIELD');
					document.addArticle.lead_content.focus();
				}
				else
					document.addArticle.submit();
			}
			function savePhotoGallery() {
				if(document.addArticle.title.value == '' || document.addArticle.title.value == ' ') {
					alert('You must specify the TITLE FIELD');
					document.addArticle.title.focus();					
				}
				else
					document.addArticle.submit();
			}
			function printArticle() {
				window.print();
			}
			function send_mail(article_id,type) {
				mail = window.open("send_mail.php?id=" + article_id + "&article_type=" + type, "ITMatters_send_this_Article_to_a_friend", "location=0,status=0,scrollbars=0,width=425,height=410");
				mail.moveTo(300, 150);
			}
			
			function print_article(article_id,type) {
				print = window.open("print_preview.php?id=" + article_id + "&article_type=" + type, "ITMatters_Print_Preview", "location=0,status=0,scrollbars=1,width=1000,height=700");
				print.moveTo(25, 25);
			}
			function onLoadFunction() {
				loguser = document.getElementById('loguser');
				
				loguser.style.display = "none";
			}
			function logusers() {
				user = document.getElementById('loguser');
				
				user.style.display = 'block';
			}
			function validatelog() {
				if(document.loguser.sender_name == '' || document.loguser.sender_name == ' ' || document.loguser.sender_name == '  ' || document.loguser.message == '' || document.loguser.message == ' ' || document.loguser.message == '  ')
					alert('You must strictly specify your name and message.\nFor security and not spamming posts...');
				else
					document.loguser.submit();
			}
			function resetlog() {
				document.loguser.reset();
			}
	
	function validate_form_mail() {
		if(document.send_mail.to.value == '' || document.send_mail.email.value == '' || document.send_mail.senders_name.value == '' || document.send_mail.senders_email.value == '') {
			alert('You must specify required fields...');
		}
		else {
			document.send_mail.submit();
		}
	}
	
	function reset_form_mail() {
		document.send_mail.reset();
	}
			function most_read() {
				var most_read = document.getElementById('most_read_body');
				var most_emailed = document.getElementById('most_emailed_body');
				
				most_read.style.display = 'block';
				most_read.style.position = 'relative';
				most_read.style.zIndex = "1";
				most_emailed.style.display = 'none';
				most_emailed.style.position = 'relative';
				most_emailed.style.zIndex = "-1";
			}
			function most_emailed() {
				var most_read = document.getElementById('most_read_body');
				var most_emailed = document.getElementById('most_emailed_body');
				
				most_read.style.display = 'none';
				most_read.style.position = 'relative';
				most_read.style.zIndex = "-1";
				most_emailed.style.display = 'block';
				most_emailed.style.position = 'relative';
				most_emailed.style.zIndex = "1";
			}
			function makeitbold() {
				var $tb = document.getElementById("title");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<b>"+str+"</b>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<b>", $selection, "</b>", $after)
				}
				 $tb.focus();
			   
			  }
			  function makeititalic() {
				var $tb = document.getElementById("title");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<i>"+str+"</i>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<i>", $selection, "</i>", $after)
			  }
				 $tb.focus();
			   
			  }
			  function makeitu() {
				var $tb = document.getElementById("title");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<u>"+str+"</u>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<u>", $selection, "</u>", $after)
				}
				 $tb.focus();
			   
				}
			  function makeitcenter() {
				var $tb = document.getElementById("title");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<center>"+str+"</center>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<center>", $selection, "</center>", $after)
			  }
				 $tb.focus();
			   
			  }
			  function makeitp() {
				var $tb = document.getElementById("title");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<p>"+str+"</p>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<p>", $selection, "</p>", $after)
				}
				 $tb.focus();
			   
				}
			function makeitboldlead() {
				var $tb = document.getElementById("lead_content");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<b>"+str+"</b>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<b>", $selection, "</b>", $after)
				}
				 $tb.focus();
			   
			  }
			  function makeititaliclead() {
				var $tb = document.getElementById("lead_content");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<i>"+str+"</i>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<i>", $selection, "</i>", $after)
			  }
				 $tb.focus();
			   
			  }
			  function makeitulead() {
				var $tb = document.getElementById("lead_content");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<u>"+str+"</u>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<u>", $selection, "</u>", $after)
				}
				 $tb.focus();
			   
				}
			  function makeitcenterlead() {
				var $tb = document.getElementById("lead_content");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<center>"+str+"</center>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<center>", $selection, "</center>", $after)
			  }
				 $tb.focus();
			   
			  }
			  function makeitplead() {
				var $tb = document.getElementById("lead_content");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<p>"+str+"</p>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<p>", $selection, "</p>", $after)
				}
				 $tb.focus();
			   
				}
			function makeitboldfull() {
				var $tb = document.getElementById("full_contents");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<b>"+str+"</b>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<b>", $selection, "</b>", $after)
				}
				 $tb.focus();
			   
			  }
			  function makeititalicfull() {
				var $tb = document.getElementById("full_contents");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<i>"+str+"</i>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<i>", $selection, "</i>", $after)
			  }
				 $tb.focus();
			   
			  }
			  function makeitufull() {
				var $tb = document.getElementById("full_contents");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<u>"+str+"</u>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<u>", $selection, "</u>", $after)
				}
				 $tb.focus();
			   
				}
			  function makeitcenterfull() {
				var $tb = document.getElementById("full_contents");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<center>"+str+"</center>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<center>", $selection, "</center>", $after)
			  }
				 $tb.focus();
			   
			  }
			  function makeitpfull() {
				var $tb = document.getElementById("full_contents");
			   
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  sel.text="<p>"+str+"</p>";
				}else if (typeof $tb.selectionStart != 'undefined'){
				  var $before, $after, $selection;
				  $before= $tb.value.substring(0, $tb.selectionStart)
				  $selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
				  $after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			   
				  $tb.value= String.concat($before, "<p>", $selection, "</p>", $after)
				}
				 $tb.focus();
			   
				}