if (top != self) top.location.replace(document.location.href);


function insert_flash(file, width, height) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ width +'" height="'+ height +'">\
<param name="movie" value="'+ file +'" />\
<param name="quality" value="high" />\
<embed src="'+ file +'" quality="high" width="'+ width +'" height="'+ height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>\
</object>');
}


function dynamic_object(objname, urlparam, endcallfce, altershowfce) {
	request_dynamic_object(objname, '/dynamic-object/'+ urlparam, endcallfce, altershowfce);
}

function show_dynamic_object(objname, xmlhttp, endcallfce, altershowfce) {
	if (xmlhttp.readyState == 4) {
		data = xmlhttp.responseText;
		if (altershowfce) altershowfce(data, objname);
		else {
			obj = document.getElementById(objname);
			obj.innerHTML = data;
		}
		if (endcallfce) endcallfce();
	}
}


function request_dynamic_object(objname, url, endcallfce, altershowfce) {
	var xmlhttp = (window.XMLHttpRequest ? new XMLHttpRequest : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false));
	if (!xmlhttp) return false;
	xmlhttp.open('GET', url);
	xmlhttp.onreadystatechange = function() {
		show_dynamic_object(objname, xmlhttp, endcallfce, altershowfce);
	};
	xmlhttp.send('');
	return true;
}

function openclose(key, classname) {
	if (!classname) classname = ''; else classname = '-'+ classname
	o = document.getElementById(key);
	if (o.className == 'openclose-closed') {
		o.className = 'openclose-opened';
		document.getElementById('oc-'+ key).className = "oc-opened"+ classname;
	} else {
		o.className = 'openclose-closed';
		document.getElementById('oc-'+ key).className = "oc-closed"+ classname;
	}
}





function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}




function movesidebanner() {
	if (document.documentElement.scrollTop) {
		t = document.documentElement.scrollTop;
		if (t <= 170)  document.getElementById('side-banner').style.marginTop = (170-t) +'px';
		else document.getElementById('side-banner').style.marginTop = 0 +'px';
	} else document.getElementById('side-banner').style.marginTop = 170 +'px';
}
window.onscroll = movesidebanner;

function showhidesidebanner() {
	w = document.documentElement.clientWidth;
	if (w >= 1350) document.getElementById('side-banner').style.display = 'block';
	else document.getElementById('side-banner').style.display = 'none';
}
addLoadEvent(showhidesidebanner);
window.onresize = showhidesidebanner;

