/* Robin JavaScripts (c) Doberman 2007 */

function kkwriting()
{
	document.getElementById('replaceable').innerHTML=document.getElementById('blogiiii').innerHTML;
}
// for different browsers
function getObj(name)
{
	if (document.getElementById)
	{
		return document.getElementById(name);
	}
	else if (document.all)
	{
		return document.all[name];
	}
	else if (document.layers)
	{
		return getObjNN4(document,name);
	}
	else
	{
		alert('Browser support for JavaScript is insufficient');
		return false;
	}
}

// netscape
function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
			foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

// obj position
function rect(item)
{
	var tuut;

	tuut = new Object();

	tuut.top = 0;
	tuut.left = 0;
	tuut.bottom = 0;
	tuut.right = 0;
	
	var parent = item.offsetParent;
	
	tuut.top += Math.floor(item.offsetTop);
	tuut.left += Math.floor(item.offsetLeft);

	while (parent) 
	{
		
		tuut.top += Math.floor(parent.offsetTop);
		tuut.left += Math.floor(parent.offsetLeft);
		
		parent = parent.offsetParent;
	}

	tuut.width = item.offsetWidth;
	tuut.height = item.offsetHeight;

	tuut.right = tuut.left + Math.floor(item.offsetWidth);
	tuut.bottom = tuut.top + Math.floor(item.offsetHeight);
	tuut.parent = item;

	return tuut;
}

// get url param
function gup( name )
{
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var tmpURL = window.location.href;
	var results = regex.exec( tmpURL );
	if( results == null ) return ""; else return results[1];
}

// openwin
function openwin(url)
{
	win = window.open(url,'window','status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,width=800,height=510');
	win.focus();
}

// openwin
function openpopup(url, width, height)
{
	win = window.open(url,'window','status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,width='+width+',height='+height);
	win.focus();
}

// focus form
function focusForm()
{
	if (document.forms && document.forms.length && document.forms[document.forms.length-1].elements[0].type != null)
	{
		if(document.forms[document.forms.length-1].elements[0]) document.forms[document.forms.length-1].elements[0].focus();
	}
}

// checkActive
function checkActive(button)
{
	target = getObj('alpha');
	if(target.className == "") { target.className = "disabled"; } else { target.className = ""; }
}

// getURL
function getURL(url) { document.location.href = url; }

// showhide divs class_act
function opendiv(root, target, classname)
{
	root = getObj(root);
	targ = getObj(target).style;
	if(targ.display == "none")
	{
		root.className = classname + "_act";
		targ.display = "block";
	}
	else
	{
		root.className = classname;
		targ.display = "none";
	}
}

// getElementsById
function getElementsById(id)
{
	var merirosvo = new Array();
	var tuuba;
	var i;	
	while((tuuba = getObj(id))!=null)
	{
		merirosvo.push(tuuba);
		tuuba.id = 'humppamaakarin kenka';
	}	
	var len;
	len = merirosvo.length;
	for(i=0; i<len; i++) { merirosvo[i].id = id; }
	return merirosvo;
}

function showhideError(name)
{
	target = getObj(name).style;
	cat = getObj('link_' + name);
	if(target.display == "none")
	{
		target.display = "block";
		if(cat) cat.className = "open";
	}
	else
	{
		target.display = "none";
		if(cat) cat.className = "closed";
	}
}

function showOld(id)
{
	ids = getElementsById(id + 'old');
	for(i=0; i<ids.length; i++)
	{
		if(ids[i].style.display == 'none') ids[i].style.display = 'block'; else ids[i].style.display = 'none';
	}
}

function showHide(id)
{
	ids = getElementsById(id);
	for(i=0; i<ids.length; i++)
	{
		if(ids[i].style.display == 'none') 
			ids[i].style.display = 'block'; 
		else 
			ids[i].style.display = 'none';
	}
}
