jQuery(document).ready(function(){
	
	//INPUT HINT
	jQuery(function(){ 
		jQuery('input[title!=""]').hint();
	});

	//CHANGE BACKGROUND
(function(jQuery) {

	jQuery.randombg = {
		defaults: {
			directory: "images/backgrounds/",
			howmany: 3

		}
	}
    jQuery.fn.extend({
        randombg:function(config) {
            var config = jQuery.extend({}, jQuery.randombg.defaults, config);
			return this.each(function() {
		
				var directory = config.directory, howmany = config.howmany;

				var which = Math.floor(Math.random()*howmany)+1;
				jQuery(this).css({"background" : " #EEE url(" +directory + which + ".jpg) center top repeat-x"});
			  
            })
        }
    })
})(jQuery);	
	jQuery("body").randombg({
    directory: "/wp-content/themes/hostway/images/bg0", //directory to image folder
    howmany: 3 //how many images are in this folder
});

	
	//EQUAL HEIGHT
	var biggestHeight = 0;
	jQuery('.equal_height').each(function(){
		if(jQuery(this).height() > biggestHeight){
			biggestHeight = jQuery(this).height();
		}
	});
	jQuery('.equal_height').height(biggestHeight);
	
	
	//NAV HOVER
	jQuery("#nav li a, #nav li li a").removeAttr("title");
	jQuery("#nav ul").css({display: "none"}); // Opera Fix
	jQuery("#nav li").hover(function(){
		jQuery(this).append("<span class=submenuTop></span>");
		jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).show(268);
	},
	function(){
		jQuery(this).find('ul:first').css({visibility: "hidden"});
		jQuery(this).find(".submenuTop").css({visibility: "hidden",display: "none"});
	});
	
	//LOGIN BOX
	jQuery("#box").css({display: "none"}); // Opera Fix
	jQuery("#loginBox").hover(function(){
		jQuery('#box').css({visibility: "visible"}).show(268);
		jQuery('.consultas').css({paddingTop: "1px", position: "relative", top: "-1px"});
		
	},
	function(){
		jQuery("#box").css({visibility: "hidden",display: "none"});
		jQuery('.consultas').css({paddingTop: "0px", top: "0px"});
	});

});



//Universal clock
		//Genuine code by Corneliu Lucian "KOR" Rusu
		var wd=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
		var D=[
		['Brasilia',-120,0],//city, standard time zone(minutes), DST(minutes)
		['Los Angeles',-480,0],
		['New York',-300,0],
		['London',0,0],
		['Tokyo',540,0]
		]
		function calc(){
			var spans=document.getElementById('zonediv').getElementsByTagName('li');
			for(var i=0;i<D.length;i++){
				var t=new Date();
				t.setTime(t.getTime()+(t.getTimezoneOffset()*60000)+((D[i][1]+D[i][2])*60000));//the zone's time
				var Dy=t.getFullYear();
				var Dd=t.getDate()<10?'0'+t.getDate():t.getDate();
				var Dm=t.getMonth()<10?'0'+(t.getMonth()+1):t.getMonth()+1;
				var Dh=t.getHours()<10?'0'+t.getHours():t.getHours();
				var Di=t.getMinutes()<10?'0'+t.getMinutes():t.getMinutes();
				var Ds=t.getSeconds()<10?'0'+t.getSeconds():t.getSeconds();
				var Dz=wd[t.getDay()];

				var text = document.createTextNode(' ' + Dh+':'+Di+':'+Ds+' ');
				spans[i].replaceChild(text, spans[i].lastChild);
			}
			setTimeout(arguments.callee,1000);
		}
		onload=function(){
			var root = document.getElementById('zonediv');
			for(var i=0;i<D.length;i++){
				var sp= document.createElement('li');
				var sp2= document.createElement('span');
				sp2.appendChild(document.createTextNode(D[i][0]));
				sp.appendChild(sp2);
				sp.appendChild(document.createTextNode(' '));
				root.appendChild(sp);
			}
			calc();
		}
