QueryLoader.init();
function UpdateTime(){

	var currentTime = new Date()
	var hours = currentTime.getHours()
	var minutes = currentTime.getMinutes()
	if (minutes < 10)
	minutes = "0" + minutes;	
	document.getElementById('clock_time').innerHTML = hours+"<span id='dots'>:</span>"+minutes;
	if(page=="portfolio" || page == "fun") {
		document.getElementById('ipad_time').innerHTML = hours+"<span id='dots'>:</span>"+minutes;
	}
	setTimeout("UpdateTime()", 60000) ;
	
}
function UpdateDayMonth(){
	var d = new Date();
	var month  = d.getMonth()+1;
	document.getElementById('clock_date').innerHTML = d.getDate()+"/"+ month;
}

UpdateTime();
UpdateDayMonth();

$.get('weather.php', function(data) {
  $('#clock_temp').html(data);
});

$(document).ready(function(){

function adjustStyle(width) {
    width = parseInt(width);
	 
	browserWidth = width;
	//document.getElementById("msg").innerHTML = width;
/*	if (width < 1360) {
    $("#size-stylesheet").attr("href", "css/narrow.css");
    
	} else if ((width >= 1360) && (width <= 1440)) {
        $("#size-stylesheet").attr("href", "css/medium.css");
    } else {
       $("#size-stylesheet").attr("href", "css/wide.css");
    }*/
}

function adjustStyleHeight(height) {
    height = parseInt(height);
	browserHeight = height;
	 
	//document.getElementById("msg").innerHTML = height;
	/*if (height < 601) {
//  	$("#size-stylesheet2").attr("href", "css/low_height.css");
    } else {
   // $("#size-stylesheet2").attr("href", "css/ok_height.css");
    }*/
}


$(function() {
    adjustStyle($(this).width());
    $(window).resize(function() {
        adjustStyle($(this).width());
    });
	
	adjustStyleHeight($(this).height());
    $(window).resize(function() {
        adjustStyleHeight($(this).height());
    });
	
	
});




$('#car_key .button').click(function(){

	var count=0;

	var int=setInterval(function(){

		count=count+1;

		if($('#car_key').hasClass('on')){

			$('#car_key').removeClass('on');$('#car').removeClass('lighted');}

		else{$('#car_key').addClass('on');$('#car').addClass('lighted');}

		

		if(count==4){clearInterval(int);}

		

		if(checkAudioCompat()) EvalSound('car_sound');

	},100);

});



$("#zippo .cover_link").toggle(function() {
if(checkAudioCompat()) EvalSound('zippo_sound_open');
	$("#zippo .cover").rotate({

		duration:1000,

		angle: 0, 

		animateTo:-136

    });



},function() {
if(checkAudioCompat()) EvalSound('zippo_sound_close');

	$("#zippo .cover").rotate({

		duration:1000,

		angle: -136, 

		animateTo:0

    });



});



});

function checkAudioCompat() {

	var myAudio = document.createElement('audio');



	if (myAudio.canPlayType) {

		// CanPlayType returns maybe, probably, or an empty string.



		if ( "" != myAudio.canPlayType('audio/mpeg')) {

			return true;

		}



		if ( "" != myAudio.canPlayType('audio/ogg; codecs="vorbis"')) {

			return true;

		}



		if ( "" != myAudio.canPlayType('audio/mp4; codecs="mp4a.40.5"')) {

			return true;

		}

		return false;

	}

	else {

		return false;

	}

}

function EvalSound(soundobj) {



  var thissound=document.getElementById(soundobj);

  thissound.play();

}

function make_blank_phone()
{
if(document.getElementById('email').value == "") {
		document.getElementById('email').value="Email:";		
}
if(document.getElementById('phone').value == "Phone:") {
	document.getElementById('phone').value="";
}
}
function make_blank_email()
{
	if(document.getElementById('phone').value == "") {
		document.getElementById('phone').value = "Phone:";		
	}
if(document.getElementById('email').value == "Email:") {
	document.getElementById('email').value="";
}

}

// Infinite blink/fade 
function effectFadeIn(classname) {
$("#"+classname).fadeOut(800).fadeIn(800, effectFadeOut(classname))
}
function effectFadeOut(classname) {
$("#"+classname).fadeIn(800).fadeOut(800, effectFadeIn(classname))
}

$(document).ready(function(){
$('#cc').colorbox({width:"80%", height:"85%", iframe:true});
//$('#whd2').colorbox({width:"80%", height:"85%", iframe:true});
//$('#chat').colorbox({width:"35%", height:"60%", iframe:true});





$("#hard_gt_sticky").rotate({ 
   bind: 
     { 
        mouseover : function() { 
            $(this).rotate({animateTo:180})
        },
        mouseout : function() { 
            $(this).rotate({animateTo:0})
        }
     } 
});
//effectFadeIn('dots');
//$('#clock_time').blink({delay:800});

});

$('#home_sticky_menu li a').click( function() {
$('#home_sticky_menu li a').removeClass('menu_active nomenu_active');
$(this).addClass('menu_active');

});


function open_chat_window(){
window.open ("http://gthost.dyndns.org/mygt/phplive/request.php?l=admin&x=1&deptid=0", "GlueTube Chat","location=1,status=1,scrollbars=1, width=450,height=450");	
}
