function return_main (timeout) {
if (timeout == "") { timeout = 1000; }
opener.focus();
opener.location.reload(true);
setTimeout('window.close()', timeout);
return true;

}


function close_sub () {
opener.focus();
setTimeout('window.close()', 500);
return true;
}

function $(id) {
    return document.getElementById(id);
} 


function get_random_content(url,element) {
   
    var xmlhttp = null;
    // Mozilla
    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.open("GET", url+""+element+"/", true);
	xmlhttp.setRequestHeader('Content-type', 'text/html; charset=iso-8859-15');
    xmlhttp.onreadystatechange = function() {
        if(xmlhttp.readyState != 4) {
            $(element).innerHTML = '<div align="center"><br><br><br><br><img src="/pics/ajax_reload.gif" alt="lade daten..."></div>';
        }
        if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            $(element).innerHTML = xmlhttp.responseText;
        }
    }
    xmlhttp.send(null);
} 

function winopen(url,name,features) {
 window.open(url,name,features);
}


function winopen2(url,name,features) {
 features2 = 'status=0,scrollbars=0,resizable=0,width=570,height=250,menubar=0';
 window.open(url,name,features2);
}


function winopen3(url,name,features) {
 features3 = 'status=0,scrollbars=0,resizable=0,width=800,height=600,menubar=0';
 window.open(url,name,features3);
}

function winopen_generic(url,x,y) {
window.open(url,'smartweb', 'status=0,scrollbars=1,resizable=0,width='+x+',height='+y+',menubar=0');
}


function get_handle_search_results(searchstring) {
    var xmlhttp = null;
    // Mozilla
    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.open("GET", "/engine/handle/search/"+searchstring+"/", true);
	xmlhttp.setRequestHeader('Content-type', 'text/html; charset=utf-8');
    xmlhttp.onreadystatechange = function() {
        if(xmlhttp.readyState != 4) {
            $('handle-results').innerHTML = '<div align="center"><img src="/pics/ajax_reload.gif" alt="lade daten..." style="border:none;"></div>';
        }
        if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            $('handle-results').innerHTML = xmlhttp.responseText;
        }
    }
    xmlhttp.send(null);
}

function get_domains_search_results(searchstring, page) {
    var xmlhttp = null;
    // Mozilla
    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.open("GET", "/engine/domain/search/"+searchstring+"/?page="+page, true);
	xmlhttp.setRequestHeader('Content-type', 'text/html; charset=utf-8');
    xmlhttp.onreadystatechange = function() {
        if(xmlhttp.readyState != 4) {
            $('domain-results').innerHTML = '<div align="center"><img src="/pics/ajax_reload.gif" alt="lade daten..." style="border:none;"></div>';
        }
        if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            $('domain-results').innerHTML = xmlhttp.responseText;
        }
    }
    xmlhttp.send(null);
}


function display_ajax_loading(element) {
	$(element).innerHTML = '<div align="center"><img src="/pics/ajax_reload.gif" alt="lade daten..." style="border:none;"></div>';
}

function update_domain_handle() {
	display_ajax_loading('ajax_loading');
	document.getElementById('submit-button').value = "Bitte warten...";
	document.getElementById('submit-button').disabled = true;
}

function update_domain() {
	display_ajax_loading('ajax_loading');
	document.getElementById('submit-button').value = "Bitte warten...";
	document.getElementById('submit-button').disabled = true;
}

function toggle_domain_prices() {

	var status = document.getElementById('domain-preise').style.display;
	if (status == "none") {
		document.getElementById('domain-preise').style.display='block';
	} else {
		document.getElementById('domain-preise').style.display='none';
	}
}

function show_domain_details(domainid) {

	domain_details = document.getElementById('domainbox-detail-'+domainid).style.display;
		if (domain_details == "none") {
		document.getElementById('domainbox-detail-'+domainid).style.display='block';
	} else {
		document.getElementById('domainbox-detail-'+domainid).style.display='none';
	}

}
