

$(function() {

	$("a.fancybox").fancybox({
		'titlePosition'	: 'inside',
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'cyclic'		: true,
		'autoScale'		: true,
		'centerOnScroll': true,
		'showCloseButton'	: true,
	});

	/* HOME */

	$(".home_schauspieler_thumbnail").css("opacity", .85);

	$(".home_schauspieler_thumbnail").mouseover(
		function() {
			$(this).css("opacity", 1);
		}
	);
	$(".home_schauspieler_thumbnail").mouseout(
		function() {
			$(this).css("opacity", .85);
			$(this).css("text-decoration", "none");
		}
	);






	/* DETAIL */

	$(".detail_schauspieler_thumbnail").mouseover(
		function() {
			$(this).css("opacity", 1);
		}
	);
	$(".detail_schauspieler_thumbnail").mouseout(
		function() {
			$(this).css("opacity", .4);
		}
	);

	$("li.fotos").css("opacity", .7);
	$("li.fotos").mouseover(
		function() {
			$(this).css("opacity", 1);
		}
	);
	$("li.fotos").mouseout(
		function() {
			$(this).css("opacity", .7);
		}
	);
	
	
	
	
	
	

	ToolTip();
	FotoToolTip();


	$('.kontaktinput').focus(function() {
		if ($(this).attr('id') == 'name' && $(this).val() == 'Ihr Name') { $(this).val(''); }
		if ($(this).attr('id') == 'email' && $(this).val() == 'Ihre E-Mail-Adresse') { $(this).val(''); }
		if ($(this).attr('id') == 'nachricht' && $(this).val() == 'Nachricht') { $(this).val(''); }
	});

	$('.kontaktinput').blur(function() {
		if ($(this).attr('id') == 'name' && $(this).val() == '') { $(this).val('Ihr Name'); }
		if ($(this).attr('id') == 'email' && $(this).val() == '') { $(this).val('Ihre E-Mail-Adresse'); }
		if ($(this).attr('id') == 'nachricht' && $(this).val() == '') { $(this).val('Nachricht'); }
	});
	


});


function FotoToolTip() {
	$('a.fototooltip').qtip({
		prerender: true,
		show: {
			delay: 0,
			effect: {
				length: 0
			}
		},
		position: {
			corner: {
				target: 'topMiddle',
				tooltip: 'bottomMiddle'
			},
			adjust: {
				screen: true,
				y: 2
			}
		},
		style: { 
			padding: 5,
			background: '#4c75ff',
			color: 'white',
			border: {
				width: 0,
				color: '#4c75ff'
			},
			tip: {
				corner: 'bottomMiddle',
				size: {
					x: 16,
					y: 8
				}
			},
		}
	});

}


function ToolTip() {
	$('a.tooltip').qtip({
		prerender: true,
		show: {
			delay: 0,
			effect: {
				length: 0
			}
		},
		position: {
			corner: {
				target: 'topMiddle',
				tooltip: 'bottomMiddle'
			},
			adjust: {
				screen: true,
				x: 0,
				y: -10
			}
		},
		style: { 
			padding: 5,
			background: '#7c623c',
			color: 'white',
			border: {
				width: 0,
				color: '#7c623c'
			},
			tip: {
				corner: 'bottomMiddle',
				size: {
					x: 16,
					y: 8
				}
			},
		}
	});

}


function MessageBox(title, message, icon) {

	$('#dialog').dialog({
		modal: true,
		buttons: {
			"OK": function() { $(this).dialog("close"); $("#dialog").empty(); }
		},
		title: title,
		width: 500
	});


	$("#dialog").empty();
	
	// icons
	if (icon) {
		message = '<span class="ui-icon ' + icon + '" style="float:left; margin:0 7px 50px 0;"></span>' + message;
	}
	
	$("#dialog").append(message);
	
	$('#dialog').dialog("open");
}






function Confirm(title, message, url) {

	$('#dialog').dialog({
		modal: true,
		buttons: {
			"Nein": function() { $(this).dialog("close"); $("#dialog").empty(); },
			"Ja": function() { $(this).dialog("close"); $("#dialog").empty(); window.location = url; }
		},
		title: title,
		width: 500
	});


	$("#dialog").empty();
	$("#dialog").append(message);
	
	$('#dialog').dialog("open");
}












var xmlHttpObject = false;

// †berprŸfen ob XMLHttpRequest-Klasse vorhanden und erzeugen von Objekte fŸr IE7, Firefox, etc.
if (typeof XMLHttpRequest != 'undefined') 
{
    xmlHttpObject = new XMLHttpRequest();
}

// Wenn im oberen Block noch kein Objekt erzeugt, dann versuche XMLHTTP-Objekt zu erzeugen
// Notwendig fŸr IE6 oder IE5
if (!xmlHttpObject) 
{
    try 
    {
        xmlHttpObject = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e) 
    {
        try 
        {
            xmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e) 
        {
            xmlHttpObject = null;
        }
    }
}


function loadcontent(container_id, url) {  

  xmlHttpObject.open("GET", url, true);
  xmlHttpObject.onreadystatechange=function() {
    if(xmlHttpObject.readyState == 4) {
      document.getElementById(container_id).innerHTML = xmlHttpObject.responseText;
    }
  }
  xmlHttpObject.send(null);

}



var response = 0;
function get(urll) {

a = $.ajax({
	type: "GET",
	url: urll,
	async: false,
	success: function(data){
    response=data;
	  },
	 });
return response;

}


function get2(url) {

  xmlHttpObject.onreadystatechange=function() {

	if( xmlHttpObject.readyState == 4 && xmlHttpObject.status == 200 && xmlHttpObject.responseText != 'undefined' )
	{
		return xmlHttpObject.responseText;	
	}
	else
	{
		return false;
	}
 
	if( xmlHttpObject.readyState == 4 && xmlHttpObject.status != 200 )
	{
		return false;
	}

  }
  xmlHttpObject.open("GET", url, false);
  xmlHttpObject.send(null);
}
