﻿$(document).ready(function() {
    //Share links
    
	$('#shareThis').click(function(){
	    shareThis();
	});
	
	$('#shareFace').click(function(){
	    shareFace();
	});
	
	$('#shareDel').click(function(){
	    shareDel();
	});
	
	$('#shareMyspace').click(function(){
	    shareMyspace();
	});
	
	$('#shareMail').click(function(){
	    shareMail();
	});
	
	//menu highlight
	var url = document.URL;
	
	if(url.indexOf('Downloads')>0){
	    $('.navDown').addClass('selected');
	    
	}else if(url.indexOf('Stories')>0){
	    $('.navReal').addClass('selected');
	
	}else if(url.indexOf('AddStory')>0){
	    $('.navSub').addClass('selected');
	}
	
});

function shareThis(){
    //alert("shareThis");
    window.open('http://www.addthis.com/bookmark.php?wt=nw&amp;pub=readwriteweb&amp;url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title), 'addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no,screenX=200,screenY=100,left=200,top=100');
}

function shareFace(){
    //alert("shareFace");
    u=location.href;t=document.title;
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
}

function shareDel(){
    //alert("shareDel");
    window.open('http://del.icio.us/post?url='+location.href+'&title='+document.title);
}

function shareMyspace(){
    //alert("shareMyspace");
    function GetThis(T, C, U, L)
	{
		var targetUrl = 'http://www.myspace.com/index.cfm?fuseaction=postto&' + 't=' + encodeURIComponent(T)
		+ '&c=' + encodeURIComponent(C) + '&u=' + encodeURIComponent(U) + '&l=' + L;
		window.open(targetUrl);
	}
	GetThis(document.title, '', location.href, 3);
}

function shareMail(){
    //alert("shareMail");
    document.location = "mailto:?Subject=True I.T. Tales - I.T. Horror Stories&Body=Hi,%0A%0ACheck out http://www.trueittales.com to view a series of comics, real stories and free industry downloads.%0A%0ASubmit your own story to win a custom drawn and signed comic, yours to keep.%0A%0ARegards,";
}