function ParTest(P1,P2) {
	alert(arguments.toString());
}


// TAFix - Onur Safak - www.onursafak.com blog.onursafak.com - gees
function TAFix(TA) {
	TA.readOnly = false;
	if(isIE()) TA.style.height = TA.scrollHeight + "px";
	else {
		TA.style.height = 0;
		TA.style.height = TA.scrollHeight + "px";
	}
	TA.style.visibility = "inherit";
	TA.readOnly = true;
}

function TAFixAll() {$$('textarea').each(TAFix)}

Event.onReady(TAFixAll);
			
// RevealM - Onur Safak - www.onursafak.com blog.onursafak.com - gees

function SendMail(User,Domain) {
	parent.location="mailto:" + User + "@" + Domain;
}

function RevealEmails() {
	RevealEmail('blogbox','onursafak.com','myemail');
}

function RevealEmail(MailBox, MailDom, FieldName) {
	var TrySpan = true;
	var RootItem;
	var MyMail = MailBox + "@" + MailDom;
	if (TrySpan) RootItem = document.getElementById(FieldName + "wrapper");
	if (!RootItem) RootItem = document.getElementById("emailwrapper");
	if (!RootItem) RootItem = document.body;
	RootItem.innerHTML = RootItem.innerHTML.replace(eval("/!" + FieldName + "!/gi"),MyMail);
}

Event.onReady(RevealEmails);

// *


//dp.sh.ClipboardSwf = "http://www.onursafak.com/sh/clipboard.swf";
//dp.sh.Utils.IncludeBrushesOnLoad('http://www.onursafak.com/sh/','JScript,xml,sql');
//dp.sh.highlightOnLoad();
//Event.onReady(function() {dp.SyntaxHighlighter.highlight()});
//Event.onReady(function() {dp.SyntaxHighlighter.HighlightAll("hl",false,false)});

dp.SyntaxHighlighter.ClipboardSwf = 'http://www.onursafak.com/sh/clipboard.swf';
dp.sh.Utils.IncludeBrushes("http://www.onursafak.com/sh/","JScript,Xml,Sql");
dp.sh.Settings.GlobalParams = {gutter : false, controls : false};
dp.sh.highlightOnLoad();

// *

function chkFullNow(Id) {
	var Els = $("p-" + Id).getElementsBySelector("div.fullpost");
	if (Els.length == 0) {
		document.getElementById("more-" + Id).style.display = "none";
	}
}

function chkFull(Id) {
	Event.onReady(function() {chkFullNow(Id)});
}

function chkFullAnchor() {
	var Els;
	var El;
	if (document.location.hash == ("#more")) {
		Els = $$("div.fullpost");
		if (Els.length = 1) {
			El = $(Els[0]);
			if(El) {
				El.insert({before : $p()});
				El.insert({before : $em("-- continues from the first page --")});
				El.previousElement().scrollIntoView();
				//window.scrollBy(0,-40);
			}
		}
	}
}

Event.onReady(chkFullAnchor);

/*function chkFull(id) {
	var post = document.getElementById(id);
	if (post) {
		var divs = post.getElementsByTagName('div');
		var found = 0;
		for (var i = 0; i < divs.length; i++) {
			if (divs[i].className == 'fullpost') {
				divs[i].style.display = 'none';
				found = 1;
			}
			if (divs[i].className == 'fcont') {
				if (found == 0) {
					divs[i].style.display = 'none';
				}
			}
		}
	}
	else {
		alert("no post : " + id);
	}
}
*/

// QLib - Onur Safak - www.onursafak.com blog.onursafak.com - gees

function isIE() {
	return (navigator.appName.indexOf("Microsoft")!=-1)?true:false;
}

function AddOnLoad(Func) {
	if (window.addEventListener) window.addEventListener("load", function(){console.debug("1"); Func()}, false);
	else if (window.attachEvent) window.attachEvent("onload", function(){console.debug("2");Func()});
	else {
		if (window.onload != null) {
			var oldOnload = window.onload;
			window.onload = function (e) {
				oldOnload(e);
				Func();
			}
		}
		else window.onload = function(){console.debug("3"); Func()};
	}
}

// Bench
//var Bench = new Benchmark();

function Benchmark() {
	this.show = function() {
		alert(this.getTime() + " secs");
	};
	this.end = function() {
		time = (new Date()).getTime() - time;
		curr = false
	};
	this.getTime = function() {
		if(curr) this.end();
			return time / 1000
	};
	this.start = function() {
		curr = true;
		time = (new Date()).getTime()
	};
	var curr = false, time = 0;
}

//
