/* UPC360.com -- Universal Properties Corp. */

$(document).ready(function() {
	
	// icon menu
	
	$("ul#iconMenu li a img").hover(
	  function () {
		var imgsrc = $(this).attr('src');
	    $(this).attr('src', imgsrc.replace('normal','hover'));
		$(this).animate({paddingTop: '10px'}, 150);
	  },
	  function () {
		var imgsrc = $(this).attr('src');
	    $(this).attr('src', imgsrc.replace('hover','normal'));
		$(this).animate({paddingTop: '0px'}, 150);
	  }
	);
	
	
	// sidebar buttons
	$("div.pushButton").mousedown(
	  function () {
	    $(this).css("background-position", "0px 2px");
	});
	
	$("div.pushButton").mouseup(	
	  function () {
		$(this).css("background-position", "0px 0px");
	});
	$("#gmap").hover(
	  function () {
	  	$(this).css("paddingTop", "1px");
	  },
	  function () {
		$(this).css("paddingTop", "0px");
	});	
	
	
	// service grid (tiles)
	$("img.serviceTile").hover(
	  function () {
	    var myId = $(this).attr("id");
		$(this).animate({opacity: '1.0'}, 150);
		$(this).css("border", "2px solid #07e");
		$('#' + myId.replace("tile_","text_")).fadeIn('fast');
	  },
	  function () {
	  	var myId = $(this).attr("id");

		$(this).animate({opacity: '0.8'}, 150);
		$(this).css("border", "2px solid #fff");
		$('#' + myId.replace("tile_","text_")).hide();
	
	});
	
	// Featured projects
	$('#projectViewer').cycle({ 
	    prev:   '#btnProjectPrevious',
	    next:   '#btnProjectNext', 
	    timeout:       5000,  // milliseconds between slide transitions (0 to disable auto advance) 
	    speed:         800,  // speed of the transition (any valid fx speed value) 
	    before:        null,  // transition callback (scope set to element to be shown) 
	    after:         null,  // transition callback (scope set to element that was shown) 
	    fit:           1,     // force slides to fit container 
	    pause:         1,     // true to enable "pause on hover" 
	    height:        300, // container height 
	    delay:         0     // additional delay (in ms) for first transition (hint: can be negative) 	
	});
	
	// App screenshots
	$('#iPhone4Screen').cycle({ 
		fx:        'uncover',
		before: function(curr, next, opts) {
					opts.animOut.opacity = 0;
		},
	    timeout:       2727,  // milliseconds between slide transitions (0 to disable auto advance) 
	    speed:         800,   // speed of the transition (any valid fx speed value) 
	    fit:           1,     // force slides to fit container 
	    pause:         0,     // true to enable "pause on hover" 
	    width:         225,   // container width
	    height:        338,   // container height 
	    delay:         0      // additional delay (in ms) for first transition (hint: can be negative) 	
	});
	
	
});
