
$(document).ready(function () {
$.backstretch('images/bg.jpg');


    $(".connect_widget button_count").mousedown( function() {
//  alert("voted");
    });





  $('span.logotxt').each(function() {
    var fontSize = 100;

    while (this.offsetWidth > 150 && fontSize > 0) {

      // adjust the font-size 5% at a time
      fontSize -= 5;
      $(this).css('font-size', fontSize + '%');
    }
  });

});



function timedCount()
{
if (document.getElementById('main_window_data').value!=''){

  clearTimeout(t);
  toSWF (document.getElementById('main_window_data').value);

}
else{
t=setTimeout("timedCount()",1000);
}
}


var popup; //A global variable that will act as the Popup ID

function makeExternalPopup_fb() {
	//Create the popup and store the returning id in the variable
	popup = window.open("auth_facebook.php", "popup_id",
		"scrollbars,resizable,width=430,height=200");
}

function makeExternalPopup_tw() {
	//Create the popup and store the returning id in the variable
	popup = window.open("auth_twitter.php", "popup_id",
		"scrollbars,resizable,width=770,height=400");
}

function getData() {
	//Check for the existence of the popup before doing anything
	if(!popup) {
		alert("Please create the popup first.");
		return;
	}
	//Access the popup elements using this ID and fetch data from it
	var data = popup.document.getElementById('popup_data').value;
	document.frm.txt.value = data;
}
function putData() {
	//Check for the existence of the popup before doing anything
	if(!popup) {
		alert("Please create the popup first.");
		return;
	}
	//Access the popup elements using this ID and put data into it
	var data = document.frm.txt.value;
	popup.document.getElementById('popup_data').value = data;
}


function page(page){
   $("#gallery").fadeOut('normal',function(){
	 $("#gallery").html('').load("gallery.php?page="+page);
	 });
	 $("#gallery").fadeIn('fast');
   };

 function thisMovie(movieName) {
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    return (isIE) ? window[movieName] : document[movieName];
   }

   function toSWF (filename) {
    // alert(filename);
    thisMovie("dboSWF").toSWF(filename);
   }

   function fromSWF (id) {
    toSWF(id);
   alert(id);
   }

   function endfilm(username){

  $.ajax({
  url: 'userlogo.php?name=' + username,
  success: function(data) {
    $('#logowrap').html(data);
    //alert('Load was performed.');

      $('span.logotxt').each(function() {
    var fontSize = 100;

    while (this.offsetWidth > 150 && fontSize > 0) {

      // adjust the font-size 5% at a time
      fontSize -= 5;
      $(this).css('font-size', fontSize + '%');
    }
  });

  }
});

    }


function vote(uid,ip){

  var msg='';
  $.ajax({
   type: "POST",
   url: "php/vote.php",
   data: "uid="+ uid + "&ip=" + ip,
   success: function(msg){
   //alert(uid+'#'+msg);
   if (msg=='ip'){
   // alert( "Fehler!");
     //location.reload("wall.php?page="+msg);
   }
   else{
   //$("#gallery").fadeOut('normal',function(){
	 //$("#gallery").html('').load("gallery.php");
	 //}
	 //);
	 //$("#gallery").fadeIn('fast',function(){
	 //  alert( "Danke f�r deine Vote! Dein Favorit ist nun auf Platz "+ msg);
	// alert("Danke!");
	 //}
	// );
	thisPage = (location.href.substring((location.href.lastIndexOf("/"))+1));
	//if (thisPage.substring(0,8)=='wall.php')
    //window.location.href=window.location.href;
   }
   }

   });
 //

}
