/**
 * @author Danielle Rivers - Identity Tank
 */

if (!window.console) {
	window.console = { log:function(){} };	
}


// Custom Void
var Void=function(){};$.fn.VoidLink=function(){return $(this).attr('href','javascript:Void()')};

$(function() { Site.Init(); }) ;

var Site = {
	
	// runs on page load
	Init: function() {
		
		// call Page object PreInit if exists
		if ( this.Page && typeof this.Page.PreInit == 'function' ) {			
			this.Page.PreInit();
		}
				
		this.AlternateRow();
		this.HorizontalScrollBar();
		this.VerticalScrollBar();
		//this.MakeCaption();
        //this.NavigationRoll();
		//this.NewsTicker();
		this.FormValidate();
		
		// call Page object PreInit if exists
		if ( this.Page && typeof this.Page.Init == 'function' ) {			
			this.Page.Init();
		}
		
	},
	Page: null,
	AlternateRow: function(){
		    $("li.list:odd").css("background-color", "#262626");
			$("ul.bulkList:odd").css("background-color", "#262626");
		  },
	HorizontalScrollBar: function(){
		var conveyor = $(".content-conveyor", $(".scrollGalleryMod")),
		item = $(".item", $(".scrollGalleryMod"));
		
		//set length of conveyor
		conveyor.css("width", item.length * parseInt(item.css("width")));
				
        //config
        var sliderOpts = {
		  max: (item.length * parseInt(item.css("width"))) - parseInt($(".scrollContainer", $(".scrollGalleryMod")).css("width")),
          slide: function(e, ui) { 
            conveyor.css("left", "-" + ui.value + "px");
          }
        };

        //create slider
        $("#slider").slider(sliderOpts);
      },
	 
	 VerticalScrollBar: function()
			{
				// this initialises the demo scollpanes on the page.
				$('#pane1').jScrollPane();
				$('#pane2').jScrollPane({showArrows:true});
				$('#pane3, #pane4').jScrollPane({scrollbarWidth:20, scrollbarMargin:10});
                
				// this allows you to click a link to add content to #pane4 and shows how to 
				// reinitialise the scrollbars when you have done this.
				$('#add-content').bind(
					'click',
					function()
					{
						$('#pane4').append($('<p></p>').html($('#intro').html())).jScrollPane({scrollbarWidth:20, scrollbarMargin:10});
					}
				);
				// and this allows you to click the link to reduce the amount of content in
				// #pane4 and reinitialise the scrollbars.
				$('#remove-content').bind(
					'click',
					function()
					{
						$('#pane4').empty().append($('<p></p>').html($('#intro').html())).jScrollPane({scrollbarWidth:20, scrollbarMargin:10});
					}
				);
			},
	 
	 /*NewsTicker: function(){
        $("ul#slowtick").liScroll({readysetgo: 0.03});
     },
     
     FormValidate: function(){
     	$("#contactMod").validate({
        rules: {
          firstname: "required",// simple rule, converted to {required:true}
          lastname: "required",
          country: "required",
          zipcode: "required",
          email: {// compound rule
          required: true,
          email: true
        },
        url: {
          url: true
        },
        message: {
          required: true
        }
        },
        messages: {
          comment: "Please tell us what you need"
        }
      });

     },
     
     
      
      /*MakeCaption: function(){
      	$('.item.captionfull').hover(function(){
			$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:560});
		}, function() {
			$(".cover", this).stop().animate({top:'420px'},{queue:false,duration:560});
			});

		}
		
		NavigationRoll: function( selector ) {
		path += "/";
		selector += "[href^=" + path + Site.Navigation.__CURRENT_PAGE + "]";
		var elements = $(selector)
			.addClass("active");
								
		return elements;
	}*/
      
	

};

