function AddFavourites(type) {
	if (type == 1) {
		var IEstring = "<a href='javascript:window.external.addfavorite(location.href,document.title);' class='linkw'>Add to Favourites<\/a>";
		var NSstring = "<a href='javascript:void(0);' title='[Ctrl + D] - Add PHPManiacs.com to your Favourites' class='linkw'>Add to Favourites</a>";
		var OPstring = "<a href='javascript:void(0);' title='[Ctrl + T] - Add PHPManiacs.com to your Favourites' class='linkw'>Add to Favourites</a>";
	}
	else {
	    var IEstring = "<a href='javascript:window.external.addfavorite(location.href,document.title);' class='linkbl'>Add PHPManiacs.com to your Favourites<\/a>";
		var NSstring = "Add PHPManiacs.com to your Favourites with <font size='1'> [Ctrl + D]</font>";
		var OPstring = "Add PHPManiacs.com to your Favourites with <font size='1'> [Ctrl + T]</font>";
	}

	var OTHstring = "Bookmark PHPManiacs.com?";
	var whichString = OTHstring;
	var agt = navigator.userAgent.toLowerCase();
	var app = navigator.appName.toLowerCase();
	var ieAgent = agt.indexOf('msie');
	var nsAgent = app.indexOf('netscape');
	var opAgent = app.indexOf('opera');
	if (ieAgent!= -1) { whichString = IEstring; } else if (nsAgent!= -1){ whichString = NSstring; } else if (opAgent!= -1) {whichString = OPstring; }
	document.write(whichString);
}

function CheckContactDetails(){
	var inputVal = document.form.email.value;
	pass = true;
	details = 'Invalid information entered.\n\n';

	if (document.form.name.value == '') {
		details+= '- Please enter Your Name.\n\n';
    	if (pass) document.form.name.focus();
		pass = false;
	}
	if (inputVal == '') {
		details+= '- Please enter an Email Address.\n\n';
    	if (pass) document.form.email.focus();
		pass = false;
	}
	else if (inputVal.indexOf("@") == -1){
		details+= '- Please enter a properly formatted Email Address.\n\n';
    	if (pass) document.form.email.focus();
		pass = false;
	}
	else if (inputVal.indexOf(".") == -1){
		details+= '- Please enter a properly formatted Email Address.\n\n';
    	if (pass) document.form.email.focus();
		pass = false;
	}
	if (document.form.user_code.value == '') {
		details+= '- Please enter the letters found in the image.\n\n';
    	if (pass) document.form.user_code.focus();
		pass = false;
	}
	if (pass) { 
		return true;
	}
	else { 
		details+= 'Please correct the above errors before proceeding.    \n\n';
		alert(details);
		return false;
	}
}

function CheckAddScriptDetails(){
	var inputVal = document.form.email.value;
	pass = true;
	details = 'Invalid information entered.\n\n';

	if (document.form.title.value == '') {
		details+= '- Please enter a Script Title.\n\n';
    	if (pass) document.form.title.focus();
		pass = false;
	}
	if ((document.form.homeurl.value == '') && (document.form.dlurl.value == '')) {
		details+= '- Please enter either a Homepage URL or Download URL.\n\n';
    	if (pass) document.form.homeurl.focus();
		pass = false;
	}
	if (document.form.descr.value == '') {
		details+= '- Please enter a Script Description.\n\n';
    	if (pass) document.form.descr.focus();
		pass = false;
	}
	if (inputVal == '') {
		details+= '- Please enter an Email Address.\n\n';
    	if (pass) document.form.email.focus();
		pass = false;
	}
	else if (inputVal.indexOf("@") == -1){
		details+= '- Please enter a properly formatted Email Address.\n\n';
    	if (pass) document.form.email.focus();
		pass = false;
	}
	else if (inputVal.indexOf(".") == -1){
		details+= '- Please enter a properly formatted Email Address.\n\n';
    	if (pass) document.form.email.focus();
		pass = false;
	}
	if (document.form.password.value == '') {
		details+= '- Please enter a Password.\n\n';
    	if (pass) document.form.password.focus();
		pass = false;
	}
	if (document.form.user_code.value == '') {
		details+= '- Please enter the letters found in the image.\n\n';
    	if (pass) document.form.user_code.focus();
		pass = false;
	}
	if (pass) { 
		return true;
	}
	else { 
		details+= 'Please correct the above errors before proceeding.    \n\n';
		alert(details);
		return false;
	}
}

function CheckScriptReportDetails(){
	pass = true;
	details = 'Invalid information entered.\n\n';

	if ((!document.form.homeurl.checked) && (!document.form.downloadurl.checked) && (!document.form.demourl.checked)) {
		details+= '- Please select which URL is broken.\n\n';
    	if (pass) document.form.homeurl.focus();
		pass = false;
	}
	if (document.form.user_code.value == '') {
		details+= '- Please enter the letters found in the image.\n\n';
    	if (pass) document.form.user_code.focus();
		pass = false;
	}
	if (pass) { 
		return true;
	}
	else { 
		details+= 'Please correct the above errors before proceeding.    \n\n';
		alert(details);
		return false;
	}
}
