window.onload = function() {
	if (!document.getElementsByTagName) {
		return false; 
	} 
	var popuplinks = document.getElementsByTagName("a");
	for (var i=0; i < popuplinks.length; i++) {		
		if (popuplinks[i].getAttribute("class") == "popup") {		
			popuplinks[i].onclick = function() {	
				openPopUp(this.getAttribute("href"));	
				return false; 	
			} 	
		}
	} 
}
function ShowTab(T)
{
	if (TabSize != null) {
		maxSize = TabSize + 1;
	} else {
		maxSize = 7;
	}

	for(i = 1; i < maxSize; i++)
	{
		document.getElementById("div" + i).style.display = "none";
		document.getElementById("tab" + i).className = "";
	}

	document.getElementById("div" + T).style.display = "";
	document.getElementById("tab" + T).className = "active";
}
function myPopup2(linkURL,wid,hght,mytitle) {
	Modalbox.show(linkURL, {title: mytitle, width: wid, height: hght+40}); return false;
}
function makeactive(tab)
{
	document.getElementById("tab1").className = "tab";
	document.getElementById("tab2").className = "tab";
	document.getElementById("tab3").className = "tab";
	document.getElementById("tab"+tab).className = "tab selected";
}
function SelectOptions(id)
{
	var rel = document.getElementById(id);
	for (i=0; i < rel.options.length; i++) {
		rel.options[i].selected = true;
	}
}
function hidediv(id) {
	if (document.getElementById) {
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) {
			document.id.display = 'none';
		}
		else {
			document.all.id.style.display = 'none';
		}
	}
}
function showdiv(id) {
	if (document.getElementById) {
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) {
			document.id.display = 'block';
		}
		else {
			document.all.id.style.display = 'block';
		}
	}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}
function CheckUncheckAll(frm) {
	count = $(frm).elements.length;
	for (i=0; i < count; i++) 
	{
		if($(frm).elements[i].checked == 1){
			$(frm).elements[i].checked = 0;
		}
		else {
			$(frm).elements[i].checked = 1;
		}
	}
}
function mark_options(id, s)
{
	var t = document.getElementById(id);
	
	if (!t)
	{
		return;
	}
	
	var rb = t.getElementsByTagName('input');
	
	for (var r = 0; r < rb.length; r++)
	{
		if (rb[r].id.substr(rb[r].id.length-1) == s)
		{
			rb[r].checked = true;
		}
	}
}
function neonixToggle(itemID,linkID,anchorID,tSwitch){
	if (document.getElementById && navigator.userAgent.indexOf('Opera') == -1){
		var itemEL = document.getElementById(itemID);
		var linkEL = document.getElementById(linkID);
		itemEL.className = itemEL.className == 'TG_visible' ? 'TG_hidden' : 'TG_visible';
	}
	if (anchorID.length != 0){;
		document.location.href = '#' + anchorID;
	}
}
if (document.getElementById && navigator.userAgent.indexOf('Opera') == -1){
	document.writeln('<style type="text/css">');
	document.writeln('.TG_visible {display: normal;}');
	document.writeln('.TG_hidden {display: none;}');
	document.writeln('</style>');
}
function hide_download_adv() {
	$('download_adv').hide();
}
function customize_download(form,div_id,site_url) {
	var container = $(div_id);
	new Ajax.Updater(container, site_url, {asynchronous:true, parameters:Form.serialize(form),onLoading: showUpdate,onLoaded: hideUpdate});
	return false;
}
function download_customized(form,site_url) {
	new Ajax.Request(site_url,
	{
					method:'post',
					asynchronous:true,
					parameters:Form.serialize(form),
					onLoading: showUpdate,
					onSuccess: function(r){
						begindownload(r.responseText);
						hideUpdate();
					}
	});
	return false;
}
function ajax_form(form,site_url,link_id) {
	var container = $(link_id);
	new Ajax.Updater(container, site_url, {asynchronous:true, parameters:Form.serialize(form),onLoading: showUpdate,onSuccess: hideUpdate});
	return false;
}
function begindownload(response) {
        $('file').value = response;
        $('super_form').submit();
}
function showUpdate() {
	$('autocompleter-loading').show();
}
function hideUpdate() {
	$('autocompleter-loading').hide();
}
function show_duration() {
	return $('respons').value = ($('resize_nr').value == "") ? 0 : $('resize_nr').value * 25;
}
function filterNonNumeric(field) {
	var result = new String();
	var numbers = "0123456789";
	var chars = field.value.split(""); // create array 
	for (i = 0; i < chars.length; i++) {
	if (numbers.indexOf(chars[i]) != -1) result += chars[i];
	}
	if (field.value != result) field.value = result;
}
function ajax_filter_language(form,site_url,link_id)
{
	var container = $(link_id);
	new Ajax.Updater(container, site_url, {asynchronous:true, parameters:Form.serialize(form),onLoading: showUpdate,onSuccess: hideUpdate});
	return false;
}
function ajax_search_filter_language(input_id,form,site_url,container)
{
	if(input_id.value.length >= 3)
	{
		new Ajax.Updater
		(
			container, 
			site_url, {
				asynchronous:true,
				parameters:Form.serialize(form),
				onLoading: function (){
					show_loader('input_loading')
				},
				onSuccess: function (){
					hide_loader('input_loading')
				}
			}
		);
		return false;
	}
}
Event.observe(window, 'load', function(){
	$$('a').each(function(element){
		if(element.rel != '') new Tip(element, element.rel, {title : '', className: 'protoClassic', effect: 'slide'});
	});
});
function show_wall_preview(anchor,tip)
{
	return new Tip(anchor, '<img src="' + tip + '" />', {title : '', className: 'img_preview', effect: 'slide'});
}