// Cookie Functions

function newCookie(sName, sVal, bExpires) {
  if (bExpires = 1) {
    var expireDate = new Date();
    expireDate.setYear(expireDate.getYear() + 1);
    document.cookie = sName + "=" + sVal + "; " + expireDate.toGMTString();
  	}
  else {
  document.cookie = sName + "=" + sVal;
  }
}

function getCookieVal(sName) {
	var cName = sName + "=";
	var i = document.cookie.indexOf(cName)
	
	if (i != -1) {
		valEnd = document.cookie.indexOf(";", i + cName.length)
    	if (valEnd == -1) valEnd=document.cookie.length
    	return document.cookie.substring(i + cName.length , valEnd)
		}
	return null
}

// Bookmark Page Function

var title;
var url;
function bookmarkPage(title,url) {
	if (window.sidebar) {
		window.sidebar.addPanel(title,url,"");
	}
	else if (window.external.addFavorite) {
		window.external.addFavorite(title,url);
	} else {
		alert("Your browser doesn't support this feature");
	}
}

// Tell a Friend

function tellaFriend() {
	var subject = "Visit this great site about Open Source";
	var samplemessage = "Hi! I found this really nice site about open source software and I'd like to share it with you. The URL is ..";
	location.href = "mailto:" + "?subject=" + subject + "&body=" + samplemessage;
}

// Show/Hide Sidebar Boxes

function showHide(id) {
	x = document.getElementById(id);	
	if (x.className=='hidden') {
		x.className='visible';
	} else {
		x.className='hidden';
	}
}

// Remove Search Field Text

function removeVal() {
	if (document.tipue.d.value == 'search') {
		document.tipue.d.value = ''
	}
}

// Current Date

function writeDate() {
	d = new Date();
//	document.write(d)
	d = String(d);
	
	d = d.substring(4,16);
	document.write(d);

}

// View Source

function viewSource() {
	document.location = "view-source:" + document.location.href;
}