//////////////////////////////////////////////////////////////////////////////
// [ABCO JS] Switch Tab
// Pretty organizer for your comments, done for a Wordpress Theme, but easy
// implemented in anything else.
//
// Author: ABn3r CO
// Author URL: http://abnercordon.com
// URL: http://abcolive.com
// CopyRight © 2009
//////////////////////////////////////////////////////////////////////////////
// If you would like to use this code you can if you email me, and tell me
// where are you going to use it, and leave this notice unchanged. This is a 
// contribution to the web development field, but I want the credits. :)
// Español? Deutsch? français? हिन्दी? 日本語? עברית/עִבְרִית?
// Translate this notice. (e.i. http://babelfish.yahoo.com/)
//////////////////////////////////////////////////////////////////////////////
// Needs: [ABCO JS] AnimeScroll
//////////////////////////////////////////////////////////////////////////////

var currentTab = null;
var abcoIntScroll = null;

function abcoSwitchTab(id) {
	if (currentTab == null && id != 'seecomments') {			
		window.document.getElementById(id).style.display = 'block';
		window.document.getElementById('seecomments').style.display = 'none';
		abcoGoto('comments');
		currentTab = id;
		return;
	} else if (currentTab != id && currentTab != null) {
		window.document.getElementById(id).style.display = 'block';
		window.document.getElementById(currentTab).style.display = 'none';
		abcoGoto('comments');
		//alert(currentTab+" "+id);
		currentTab = id;
	} else {
		abcoGoto('comments');
	}
}

//TESTING PURPOSES
function abcoGiveMePageOffset() {
		offset = abcoGetPageOffset();
		msg = offset[0] + " " + offset[1] + "\n";
		msg += "Screen Size Y:" + abcoGetScreenSize() + " " + "Total Website Height:" + (abcoGetWebsiteSize()) + "\n";
		alert(msg);
}

//COMMENTS COPYING
function abcoCommentReply(authorID, commentID, switchTo) {
	var author = window.document.getElementById(authorID).innerHTML;
	var to  = '<a href="#' + commentID + '">@' + author.replace(/\s|\t|\n/g, "") + '</a> \n';
	abcoSwitchTab(switchTo);
	window.document.getElementById("comment").value += to;
}
	
function abcoCommentQuote(authorID, commentID, commentBody, switchTo) {
	var author = window.document.getElementById(authorID).innerHTML;
	var comment = window.document.getElementById(commentBody).innerHTML;
	var reply  = '<a href="#' + commentID + '">@' + author.replace(/\s|\t|\n/g, "") + '</a> <blockquote>' + comment.replace(/[\n]*|\t|/g, "") + "</blockquote> \n";
	abcoSwitchTab(switchTo);
	window.document.getElementById("comment").value += reply;
}
