function sendajax(url){
		 $("#module1").load(url+'ajax/1');
}

runOnLoad(
     function(){
		 $('.tab').click(function() {
			 if (this.href.substr(0, 11)!='javascript:')
			 {
			// Ajax function here
				var url = this.href;

				this.href= "javascript:sendajax('"+url+"')";

			 }
			//End Ajax
		 })
	}
);



function open_popup_window(url, x, y) {
	window.open(url,"js_window","width="+x+",height="+y+",dependent=yes,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,status=no,location=no,top=90,left=110");
}
function open_popup(url) {
	window.open(url,"js_window","width=600,height=400,dependent=yes,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,status=no,location=no,top=90,left=110");
}

var tempString = unescape(location.href);
var	url;
if (tempString.indexOf('?')!=-1) {
	url = tempString.substr(0,tempString.indexOf('?'));
}else
url = tempString;

function GetXmlHttpObject(){
	var xmlHttp = null;
	try{
	 // Firefox, Opera 8.0+, Safari
	 xmlHttp=new XMLHttpRequest();
	}
	catch (e){
	// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
function SendReq(url, element){
	var req = GetXmlHttpObject();
	//ShowLoadingBox(element);
	loadAnimationStart();
	window.status='loading';
	req.onreadystatechange = function(){
		if(req.readyState == 4 && req.status == 200) {
			if (element != ""){
				response = req.responseText;
		    	document.getElementById(element).innerHTML = response;
			}
			//HideLoadingBox(element);
			loadAnimationStop();
	    }
    }
    req.open("GET", url, true);
    req.send(null);

}

function showAjaxTab(element,footer,module,el,url,tabName){
	var req = GetXmlHttpObject();
	divs=document.getElementsByName(tabName);
	for(i=0;i<divs.length;i++){
		divs[i].className='';
	}
	el.className='active';
	$('#'+footer).html($('#'+footer+el.id).html());
	loadAnimationStart();
	$('#'+module).height($('#'+element).height());
	$('#'+element).fadeOut();
	window.status='loading';
	req.onreadystatechange = function(){
		if(req.readyState == 4 && req.status == 200) {
			if (element != ""){
				response = req.responseText;
		    	document.getElementById(element).innerHTML = response;
			}
				$('#'+module).height('');
		$('#'+element).fadeIn();
	loadAnimationStop();
	    }
    }
    req.open("GET", url, true);
    req.send(null);
}

function showAjaxTabSlide(element,module,url,tabName,mode){
	var req = GetXmlHttpObject();
	divs=document.getElementsByName(tabName);

	loadAnimationStart();
	$('#'+module).height($('#'+element).height());
	$('#'+element).fadeOut();
	window.status='loading';
	req.onreadystatechange = function(){
		if(req.readyState == 4 && req.status == 200) {
			if (element != ""){
				response = req.responseText;
		    	document.getElementById(element).innerHTML = response;
			}
				$('#'+module).height('');
		$('#'+element).fadeIn();
	loadAnimationStop();
	    }
    }
    req.open("GET", url, true);
    req.send(null);
}
function showTab(el,url){
    element = 'test';
	var req = GetXmlHttpObject();
	divs=document.getElementsByName('tabLeft');
	for(i=0;i<divs.length;i++){
		divs[i].className='';
	}
	el.className='active';
	$('#footer').html($('#footer'+el.id).html());
	loadAnimationStart();
	$('#moduleShout').height($('#test').height());
	$('#test').fadeOut();
	window.status='loading';
	req.onreadystatechange = function(){
		if(req.readyState == 4 && req.status == 200) {
			if (element != ""){
				response = req.responseText;
		    	document.getElementById(element).innerHTML = response;
			}
				$('#moduleShout').height('');
		$('#test').fadeIn();
	loadAnimationStop();
	    }
    }
    req.open("GET", url, true);
    req.send(null);
}
function ajax(url,el){

	element = 'test';
	var req = GetXmlHttpObject();


	$('#moduleShout').height($('#test').height());
	$('#test').fadeOut();
		loadAnimationStart();
	window.status='loading';
	req.onreadystatechange = function(){
		if(req.readyState == 4 && req.status == 200) {
			if (element != ""){
				response = req.responseText;
		    	document.getElementById(element).innerHTML = response;
			}
				$('#moduleShout').height('');
		$('#test').fadeIn();
			loadAnimationStop();
	    }
    }
    req.open("GET", url, true);
    req.send(null);
}
function  sendShout(url,id){
	var shout = escape($("input#shout").val());
	$("input#shout").value='';
	url +='shout/'+shout+'/ajax/1';
	ajax(url,id);
}

function onEnter(event,url,id){
	if(event.keyCode==13)
		sendShout(url,id);
}


function imgEfecgt(el){
	document.getElementById(el).innerHTML ='';
	var div = document.createElement("div");
	div.setAttribute("id","blocking_div"+el);
	div.innerHTML = '<img  src="i/logo_loader.gif" style="margin:0"/>';
	document.getElementById(el).appendChild(div);
}
function ShowLoadingBox(el){

	$("#"+el).fadeOut(1000);

}

function HideLoadingBox(el){

		$("#"+el).fadeIn('fast');
}

function showDiv(id){
	document.getElementById(id).style.display = 'block';
}


function removeDiv(id){
	document.getElementById(id).style.display = 'none';
		document.getElementById(id).innerHTML = '';
}

function strpos( haystack, needle, offset){
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Onno Marsman
    // *     example 1: strpos('Kevin van Zonneveld', 'e', 5);
    // *     returns 1: 14

    var i = (haystack+'').indexOf( needle, offset );
    return i===-1 ? false : i;
}
function hideDiv(id){
	document.getElementById(id).style.display = 'none';
}

$(document).ready(function(){
	loadAnimationInit('mouseAjax',41,35);

	$('a').click(function(){
	if (!$(this).hasClass('http')) {

	if ($(this).attr('href')!=null) {

	if ($(this).attr('href').substr(0,4)=='www') {
		window.open($(this).attr('href'),'_self');
		return false;
	}

	if ($(this).attr('href').substr(0,4)!='http' || strpos($(this).attr('href'),'partykel',4)) {
		loadAnimationStart();
	}else{
		window.open($(this).attr('href'),'_self');
		return false;
	}
	}

	}
	});



});
function deleteGuestbook(url){
	var conf =  confirm('Bist Du sicher,dass Du den Eintrag löschen möchtest?');
		if (conf) {
	 window.location = url;
	}
	return ;
}


function deleteComment(url){
		var conf =  confirm('Bist Du sicher,dass Du den Kommentar löschen möchtest?');
		if (conf) {
	  window.location = url;
	}
	return ;
}

function addDiv(id, content){
	var mainDiv = opener.document.getElementById(id);
	var newDiv = opener.document.createElement("div");
	newDiv.innerHTML = content;
	mainDiv.appendChild(newDiv);
}

function transferdataout(id,dt_id) {
opener.document.getElementById('object_id').value =id;
opener.document.getElementById('object_type').value =dt_id;
//return false

}


$(document).ready(function(){
	$("a.switch_thumb").toggle(function(){
	  $(this).addClass("swap");
	  $("ul.display").fadeOut("fast", function() {
	  	$(this).fadeIn("fast").removeClass("thumb_view");
		 });
	  }, function () {
      $(this).removeClass("swap");
	  $("ul.display").fadeOut("fast", function() {
	  	$(this).fadeIn("fast").addClass("thumb_view");
		});
	});

});