var isOpera = (window.opera);
var isIE = (document.all && !isOpera);

var Page, Content, Rootmenu, loadinfo;

function empty(obj) {
	obj.value = "";
}

function is_set() {
	if (arguments.length) {
		obj = arguments[0];
		if (typeof obj != 'undefined') return true;
	}
	return false;
}

function expose(obj) {
	deli = '\n';
	var level = 0;
	if (arguments[1]) deli = arguments[1];
	if (arguments[2]) {
		level = parseInt(arguments[2]);
  	if (level > 4) return '';
	}
  if (obj) {
    var text = "";
  	to = (typeof obj);
    if (to.indexOf('string')>=0) {
			text += (to+' '+obj+'\n');
		}
		else {
			for (prop in obj) {
	  		to = (typeof obj[prop]);
        text += (str_repeat('\t',level)+to+' '+prop+'='+obj[prop]+deli);
				nextlevel = level+1;
		  	if (to.indexOf('object')>=0) text += expose(obj[prop],deli,nextlevel);
		  }
    }
  }
	return text+'\n';
}

function str_repeat(text,iterations) {
	var t = '';
	if (text) for (i=1; i<=iterations; i++) {
		t += text;
	}
	return t;
}

function copyArray(src_array,dst_array) {
	if (src_array) for (i in src_array) {
		dst_array[i] = src_array[i];
	}
}

function getScrollPos(win) {
	var x,y;
	if (win.pageYOffset) // all except Explorer
	{
		x = win.pageXOffset;
		y = win.pageYOffset;
	}
	else if (win.document.documentElement && win.document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		x = win.document.documentElement.scrollLeft;
		y = win.document.documentElement.scrollTop;
	}
	else if (win.document.body) // all other Explorers
	{
		x = win.document.body.scrollLeft;
		y = win.document.body.scrollTop;
	}
	return Array(x,y);
}

function getOffset(obj) {
  otop = 0; oleft = 0;
  ctop = 0; cleft = 0;
  if (obj) {
    ctop = obj.offsetTop; cleft = obj.offsetLeft;
    otop = ctop; oleft = cleft;
    p = obj.offsetParent;
    while (p) {
      ctop += p.offsetTop; cleft += p.offsetLeft;
      p = p.offsetParent;
    }
    return Array(cleft,ctop,oleft,otop);
  }
}

function getOffsetOf(obj) { return getOffset(obj); }

function hijack(obj,target) {
	var url = obj.href;
	var set_ajax = '&ajax=1';
	var default_content = '<p style="margin: 3em auto;">LOADING...</p>';
	var js_action = '';
	if (arguments[2] != null) {
		default_content = arguments[2];
	}
	if (typeof arguments[3] != 'undefined') {
		js_action = arguments[3];
	}
	if (default_content) setContent(target,default_content);
	triggerURL(target,url + set_ajax,null,null,'runScripts("'+target+'");'+js_action);
	return false;
}

function href_to_mel(linkobj,name) {
	linkobj.href = 'o:'+name+'\100mymegatoys.de';
	linkobj.href = 'lt'+linkobj.href;
	linkobj.href = 'mai'+linkobj.href;
}

function linktext_to_mel(linkobj,name) {
	linkobj.innerHTML = name+'\100mymegatoys.de';
}
