$(document).ready(function() {

if(where == 'home') {
// use 'random' instead of 'sequence' for random sequence
$('#random').innerfade({ speed: 'slow', timeout: 6500, type: 'sequence', containerheight: '320px' });

// tweet module
$(".tweet").tweet({
username: "mashsf",
//join_text: "auto",
avatar_size: 16,
count: 3,
auto_join_text_default: "we said,",
auto_join_text_ed: "we",
auto_join_text_ing: "we were",
auto_join_text_reply: "we replied to",
auto_join_text_url: "we were checking out",
loading_text: "loading tweets..."
});


// get first blog img
//$.ajax({
//url : 'http://mashsf.com/_dev/_wordpress/index.php',
//dataType : 'html',
//cache: false,
//error: function() { $('#blogPreview a').append(" Sorry, Ajax didn't load");},
//success : function( data ) {

// throw into variable
//var siteData = data;

//var postData = $(siteData).find('div.post-entry:first').html(); // get first post
//var imgUrl = $(postData).find('img:first').attr('src'); // get first image

// no image in post
//if(imgUrl == null) {
//imgUrl = '/_img/blog_no_image.jpg';
//}

//$('#blogPreview').css('background-image', 'url(' + imgUrl + ')'); // throw it into module

//} // END success
//}); // END ajax

} // END home page


// navigation 'on' state
// take all classes off
$('#nav.li a').removeClass('on');

// add class to where you're at
if(where == 'home') {
$('li.homeNav a').addClass('on');
}
if(where == 'photosets') {
$('li.photosNav a').addClass('on');
}


if(where == 'blog') {
$('li.blogNav a').addClass('on');

// set height of blog window
$('#blogFrame').load( function() {
var $ifbody = $(this).contents().find( 'body' );
$ifbody.css( 'height','auto' );
$(this).height( $ifbody.height() );


var $iflink = $(this).contents().find( '#navigation a' );

// scroll main window back to top
$iflink.click(function(){
$('html, body').animate({scrollTop:0}, 'slow');
});

});
}


if(where == 'store') {
$('li.storeNav a').addClass('on');
}
if(where == 'links') {
$('li.linksNav a').addClass('on');
$('.links').jScrollPane({showArrows:true, scrollbarWidth: 14, arrowSize: 10});



/* links form */
$("#submit").click(function(){					   				   

$(".error").hide();

var hasError = false;
var linkVal = $("#linkitem").val();

if(linkVal == '') {
$("#linkitem").after('<span class="error">No links entered.</span>');
hasError = true;
}

	
if(hasError == false) {
$(this).hide();

$.post("sendlink.php", { message:linkVal }, function(data){

$("#linkitem").after('<p class="error">Your links were sent.</p>');										
});
}

return false;
});
}
/* END links */


if(where == 'contact') {
$('li.contactNav a').addClass('on');
}

if(where == 'videos') {
$('li.videoNav a').addClass('on');
}

// set height of nav
$('#navigation').css('height', $(document).height());

/*
$(window).resize(function() {
$('#navigation').css('height', $(window).height());
});
*/



});
// END dom ready
