$(document).ready(function(){
	var austDay = new Date();
	austDay = new Date(austDay.getFullYear(), 11, 1);
	$("#CountDown").countdown({
		until: austDay,
		timezone: +3,
		format: 'dHMS',
		expiryText: 'Tiberius is open NOW Wellcome!'
	});

	$('#tabs').tabs();
	$('#tabs2').tabs();
	$('#tabs3').tabs();
	$('#MainTab').tabs();
	
	// Dialog			
	$('#dialog2').dialog({
		autoOpen: false,
		bgiframe: true,
		width: 850,
		buttons: {
			"Ok": function() { 
				$(this).dialog("close"); 
			}, 
			"Cancel": function() { 
				$(this).dialog("close"); 
			} 
		}
	});
	$('#dialog3').dialog({
		autoOpen: true,
		bgiframe: true,
		width: 700,
		height: 400,
		buttons: {
			"Vote Us": function() {
				pageTracker._trackPageview('/home/OKButton');
				$(this).dialog("close"); 
			} 
		},
		beforeclose: function(event, ui) {
			window.open("http://www.xtremetop100.com/in.php?site=1132278989","VoteUs","menubar=1,resizable=1,width=800,height=600");
			pageTracker._trackPageview('/home/Xbutton');
		}
	});
	// Dialog Link
	$('#dialog_link').click(function(){
		$('#dialog').dialog('open');
		return false;
	});
	$('#cc').click(function(){
		$('#dialog2').dialog('open');
		return false;
	});
	
	$('#DateofBirth').datepicker({
		inline: true,
		changeYear: true,
		firstDay: '1',
		yearRange: '1950:2009',
		dateFormat: 'yy-mm-dd'
	});
	
	$('#form_fade').fadeTo("slow", "0.70");
	
	$('#form_fade').hover(
      function () {
        $(this).fadeTo("slow", "1.00");
      }, 
      function () {
        $(this).fadeTo("slow", "0.70");
      }
    );

	$('#form_fade2').fadeTo("slow", "0.80");
	
	$('#form_fade2').hover(
      function () {
        $(this).fadeTo("slow", "1.00");
      }, 
      function () {
        $(this).fadeTo("slow", "0.80");
      }
    );
	if (document.getElementById && document.createTextNode){
		addEvent(window,'load', doIframe);
	}
});

function height() {
	addEvent(window,'load', doIframe);
}

function doIframe(){
o = document.getElementsByTagName('iframe');
for(i=0;i<o.length;i++){
if (/\bautoHeight\b/.test(o[i].className)){
setHeight(o[i]);
addEvent(o[i],'load', doIframe);
}
}
}

function setHeight(e){
if(e.contentDocument){
e.height = e.contentDocument.body.offsetHeight + 35;
} else {
e.height = e.contentWindow.document.body.scrollHeight;
}
}

function addEvent(obj, evType, fn){
if(obj.addEventListener)
{
obj.addEventListener(evType, fn,false);
return true;
} else if (obj.attachEvent){
var r = obj.attachEvent("on"+evType, fn);
return r;
} else {
return false;
}
}
