function openWindow(page_name,width,height) {
	if (width==null) var width=700;
	if (height==null) var height=700;
	
	winStats='toolbar=yes,location=no,directories=yes,menubar=yes,'
	winStats+='scrollbars=yes,resizable=yes,status=yes,width='+width+',height='+height
	if (navigator.appName.indexOf("Microsoft")>=0) {
		winStats+=',left=15,top=20'
	}else{
		winStats+=',screenX=15,screenY=20'
	}
	floater=window.open(page_name,"floater",winStats);
}

function hidealldiv() {
	hidediv('home-submenu');
	hidediv('content-submenu');
	hidediv('subscribe-submenu');
	hidediv('about-submenu');
	hidediv('contact-submenu');
	hidediv('mybpb-submenu');
	hidediv('other-submenu');
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function showhide(id) {
  if (document.getElementById){
	obj = document.getElementById(id);
	if (obj.style.display == "none"){
		obj.style.display = "";
	} else {
		obj.style.display = "none";
	}
  }
}

function changecolor(id,color1,color2) {
	if (!color2) color2 = "#abc";
	obj = document.getElementById(id);
	obj.style.background = color1;
	obj.style.borderBottom = "1px solid "+color2;
}

function hidesearchdivs_old() {
	if (document.getElementById('article')!=null) hidediv('article');
	if (document.getElementById('book')!=null) hidediv('book');
	if (document.getElementById('blog')!=null) hidediv('blog');
	if (document.getElementById('other')!=null) hidediv('other');
	if (document.getElementById('resource')!=null) hidediv('resource');
}
function hidesearchdivs(total) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		for (i=1; i<=total; i++) {
			idname = "type_"+i;
			if (document.getElementById(idname)!=null) hidediv(idname);
		}
	}
}

function changeclass(typenum,total) {
	// make all tabs inactive and then make selected tab active...
	var idbase = "li_";
	var thisid = idbase+typenum;
	if (document.getElementById) { // DOM3 = IE5, NS6
		for (i=0; i<=total; i++) {
			if (document.getElementById(idbase+i)!=null) document.getElementById(idbase+i).className = 'inactive';
		}
		document.getElementById(thisid).className = 'active';
	} else {
		if (document.layers) { // Netscape 4
			var tempid;
			for (i=0; i<=total; i++) {
				tempid = idbase+i;
				if (document.tempid!=null) document.tempid.className = 'inactive';
			}
			document.thisid.className = 'active';
		} else { // IE 4
			var tempid;
			for (i=0; i<=total; i++) {
				tempid = idbase+i;
				if (document.all.tempid!=null) document.all.tempid.className = 'inactive';
			}
			document.all.thisid.className = 'active';
		}
	}
}


/* ====================================================== */
/* The following function allow user to set the font size */
function setFontCookie(name, value) {
  var curCookie = name + "=" + escape(value) + "; expires=Wed, 07-Jun-2023 11:07:25 GMT; path=/; domain=bulletpointbusiness.com";
  /* 
  var curCookie = name + "=" + escape(value) + "; expires=Wed, 07-Jun-2023 11:07:25 GMT; path=/; domain=careerturn.com";
  var curCookie = name + "=" + escape(value) + "; expires=Wed, 07-Jun-2023 11:07:25 GMT; path=/; domain=webmastersherpa.com";
  */
  document.cookie = curCookie;
  window.location.href = window.location.href;
}
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
	begin = dc.indexOf(prefix);
	if (begin != 0) return null;
  } else
	begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
	end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}
if (getCookie('fontsize') == null) {
	var fontsize = 12;
} else {
	var fontsize = getCookie('fontsize');
}

function changeFontSize (direction) {
	if (direction == "decrease") { fontsize--; fontsize--; }
	if (direction == "increase") { fontsize++; fontsize++; }
	setFontCookie('fontsize',fontsize);
	alert('font size has been set to '+fontsize+'px');
}
document.write('<style type="text/css">');
document.write('.main {font-size:'+fontsize+'px;}');
document.write('.content {font-size:'+fontsize+'px;}');
document.write('<\/style>');
/* ====================================================== */


/* ====================================================== */
/* AJAX stuff */
/* ====================================================== */
// ---------------------------
// --- Browser Support Code
// ---------------------------
function GetXmlHttpObject() {
  var xmlHttp=null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}


// ---------------------------
// --- confirmDelete
// ---------------------------
function confirmDelete(id) {
  if( !confirm( "Are you sure you want to delete "+id+"?" ) ) {
    return false;
  } else {
    return true;
  }
}


// ---------------------------
// --- ajaxReportBadLink
// ---------------------------
function ajaxReportBadLink(hrefname,thispage) {
	var showname = "show"+hrefname;
	var idname = "badlink"+hrefname;
	var formname = "form"+hrefname;
	var linkid = hrefname+"link";
	ajaxRequest=GetXmlHttpObject();
	if (ajaxRequest==null) {
		alert ("Your browser does not support AJAX!");
		return;
	} 

	var comment = eval("document."+formname+".comment.value");
	var id = eval("document."+formname+".link.value");
	var name = eval("document."+formname+".name.value");
	var email = eval("document."+formname+".email.value");

	var url = "/includes/ajax.php?function=badlink";
	var parameters = '&id=' + escape(id) + '&comment=' + escape(comment) + '&thispage=' + escape(thispage) + '&name=' + escape(name) + '&email=' + escape(email);

	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange=function() {
		if(ajaxRequest.readyState==4) {
			document.getElementById(idname).innerHTML='<div id="+idname+" style="color:green;">Thanks for reporting the bad link!</div>';
			alert("Bad Link Message Sent");
	    } else {
			document.getElementById(idname).innerHTML='<div id="+idname+" class="working" style="color:red">Reporting</div><br />';
		}
	}

	ajaxRequest.open("POST",url,true);
	ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	ajaxRequest.setRequestHeader("Content-length", parameters.length);
	ajaxRequest.setRequestHeader("Connection", "close");
	ajaxRequest.send(parameters);
}

