//***CSS Functions
	function getTagStyle(el,styleProp){
		var x = document.getElementsByTagName(el)[0];
		if (x.currentStyle)
			var y = x.currentStyle[styleProp];
		else if (window.getComputedStyle)
			var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
		return y;
	}
	
	function getIdStyle(el,styleProp){
		var x = document.getElementById(el);
		if (x.currentStyle)
			var y = x.currentStyle[styleProp];
		else if (window.getComputedStyle)
			var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
		return y;
	}
	
	function toggleDiv(id){
		if (document.getElementById(id).style.display != "block"){
			document.getElementById(id).style.display = "block";
		}else{
			document.getElementById(id).style.display = "none";
		}
	}
//***End CSS Functions


//****Cookie functions	
	function Set_Cookie( name, value, expires, path, domain, secure ) {
		// set time, it's in milliseconds
		var today = new Date();
		today.setTime( today.getTime() );
		if ( expires ){
			expires = expires * 1000 * 60 * 60 * 24;
		}
		var expires_date = new Date( today.getTime() + (expires) );
		
		document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
	}
	function Get_Cookie( name ) {
		
		var start = document.cookie.indexOf( name + "=" );
		var len = start + name.length + 1;
		if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ){
			return null;
		}
		if ( start == -1 ) return null;
		var end = document.cookie.indexOf( ";", len );
		if ( end == -1 ) end = document.cookie.length;
		return unescape( document.cookie.substring( len, end ) );
	}
//****End Cookie functions	


//Trigger onclick event
function noClick(elId) {
	var evt;
	var el = document.getElementById(elId);
	if (document.createEvent){
		evt = document.createEvent("MouseEvents");
		if (evt.initMouseEvent){
			evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
		} else {
			evt = false;
		}
	}
	(evt)? el.dispatchEvent(evt):(el.click && el.click());
}

//Attach event
function addEvent(obj, evType, fn){ 
	if (obj.addEventListener){ 
		obj.addEventListener(evType, fn, false); 
		return true; 
	} else if (obj.attachEvent){ 
		var r = obj.attachEvent("on"+evType, fn); 
		return r; 
	} else { 
		return false; 
	} 
}


//get contents of meta tag
function getMetaContents(mn){ 
    var m = document.getElementsByTagName('meta'); 
    for(var i in m){ 
        if(m[i].name == mn){ 
            return m[i].content; 
        } 
    } 
}

//Facebook share function 
function fbs_click(obj) {
	u=location.href;
	t=document.title;
    loc='http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t);
    obj.href=loc;
	window.open(loc,'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}

//Digg share function
function digg_click(obj) {
	url=encodeURIComponent(location.href);
	title=encodeURIComponent(document.title);
    bodytext=encodeURIComponent(getMetaContents('description').substr(0,300));
    loc='http://digg.com/submit?url=' + url + '&title=' + title + '&bodytext=' + bodytext;
    obj.href=loc;
	window.open(loc,'sharer','toolbar=0,status=0');
	return false;
}

//Digg share function
function del_click(obj) {
	url=encodeURIComponent(location.href);
	title=encodeURIComponent(document.title);
    loc='http://del.icio.us/post?v=2&url=' + url + '&title=' + title;
    obj.href=loc;
	window.open(loc,'sharer','toolbar=0,status=0');
	return false;
}

//Digg share function
function stu_click(obj) {
	url=encodeURIComponent(location.href);
	title=encodeURIComponent(document.title);
    loc='http://www.stumbleupon.com/submit?url=' + url + '&title=' + title;
    obj.href=loc;
	window.open(loc,'sharer','toolbar=0,status=0');
	return false;
}