/*CHECK CLIENT-BROWSERVERSION*/
var ns4up = (document.layers) ? 1 : 0;
var ie4up = (document.all) ? 1 : 0;
var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? 1 : 0;
var aktivFontSize = 12;

/*END OF CHECK*/
var ajaxPath = siteUri + '/d/ajax';
var imgPath = siteUri + '/images';
var setNotSearchFocus = false;
var autoCompleter = false;

/*
 * This Function is of all pages
 */
function onLoad(){
	if(window.outerWidth <= 800) {$("root").style.left = "0";}
	if(window.outerWidth <= 800) {$("footer").style.left = "0";}
	if(setNotSearchFocus != true) searchfocus();
}

function searchfocus() 
{
	/*
	 * avoid to jump back to top of page after autoscroll to anchor
	 */
	if(document.forms['search']){
	var y = 0;   
	if (window.pageYOffset) {     
		y = window.pageYOffset;   
	} else if (document.body && document.body.scrollTop) {     
		y = document.body.scrollTop;   
	}   
	if (y == 0) {
		if(window.location.href.indexOf("#") < 0) {
		    var string = document.forms['search'].searchstr.value;
	    	if(string == '') {
	        	document.forms['search'].searchstr.focus();
		    }
		}
	}
	}
}



function filterMenu(id) {
	var openImgDiv = imgPath +"/arrow-open.gif"; 
	var closeImgDiv = imgPath +"/arrow-close.gif"; 
	var image = document.getElementById("i-" + id);
	var divId = 'f-' + id;
	var more = 'moreFV-' + id;
	
	new Effect.toggle($(divId),'slide');
	var obj = document.getElementById ? document.getElementById(divId) : document.all ? document.all[divId] : null;
	var moreFV = document.getElementById ? document.getElementById(more) : document.all ? document.all[more] : null;
	if (image && image.src){
		if(obj.style.display != 'none'){
			obj.style.display = 'block'; 
			image.src = closeImgDiv;
		}else{
			obj.style.display = 'none';
			image.src = openImgDiv;
			//Element.addClassName(obj,"f-over");
		}
	}
	
}

function searchOnTB (myForm)
{
	var searchString = myForm.searchstr.value;
	var searchURL = 'http://www.testberichte.de/d/search.php?searchstr=';
	var newLocation = searchURL + searchString + '&addon=2';
	alert(newLocation);
	window.location = newLocation;
}
/*****************************
 *                           *
 * Add Bookmark				 *
 *                           *
 *****************************/
function addFavorites() 
{
	if (document.all && !window.opera) {// MSIE
		document.write("<img src=\"" + imgPath + "/icon/bookmark.png\" alt=\"\" />");
		document.write("<a href=\"javascript:window.external.AddFavorite(location.href, document.title);\">Bookmark speichern</a><br />");
	}else if((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')){// NS6+, Mozilla
		document.write("<img src=\"" + imgPath + "/icon/bookmark.png\" alt=\"\" />");
		document.write("<a href=\"javascript:window.sidebar.addPanel(document.title, location.href, '');\">Bookmark speichern</a><br />");
	}else if (window.opera){ // Opera
		document.write("<img src=\"" + imgPath + "/icon/bookmark.png\" alt=\"\" />");
		document.write("<a href=\"" + location.href + "\" title=\"" + document.title + "\" rel=\"sidebar\">Bookmark speichern</a><br />");
	}
}
/*****************************
 *                           *
 * Mozilla AddOn tb-search	 *
 *                           *
 *****************************/
function addSearch()
{
	var alert_string = "Plugin konnte nicht installiert werden.\n" 
					 + "Das Plugin steht für die Browser Firefox und Internet Explorer 7 zur Verfügung";
	if(window.XMLHttpRequest){//IE 7, mozilla, safari, opera 9
		if (document.all && !window.opera) {
			window.external.AddSearchProvider("http://www.testberichte.de/downloads/de-search-ie7.xml");
		}else if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function")) {
	         window.sidebar.addSearchEngine("http://www.testberichte.de/downloads/de-search.src", "http://www.testberichte.de/favicon.ico", "Testberichte.de", "Produkttestsuche");
	    } else {
	        alert(alert_string);
	    }
	} else {
	        alert(alert_string);
	}
}