// Custom js functions for brianparkphoto.com

/*
VERY important note

When writing your jQuery code, you must use jQuery(”#DIV”) or jQuery.get() 
- emphasis on the jQuery rather than using $(”#DIV”) or $.get
 - Using $ will not work as its already been set aside by the javascript library “Prototype” which is also used by WordPress. 
It is case sensitive too, so no jquery or Jquery!!
*/

var baseurl; 
var pathToDir = '/wp-content/themes/brianparkphoto/';

jQuery(document).ready(function()
{
	//alert("ready");
});

// called from inside swf to scroll page when needed
function scrollPageTo(targ) 
{
	jQuery('html, body').animate({scrollTop:targ}, 'normal'); 
	//alert("scrollPageTo: " + targ);
}
// called from inside swf to check if scroll is needed
function scrollPageToCheck(targ) 
{
	//alert("scrollPageCheck \ntarg: " + targ + "\nwindow scroll: " + getScrollY());
	if(targ < getScrollY())
	{
		//alert("SCROLL / Target is < \ntarg: " + targ + "\nwindow scroll: " + getScrollY());
		jQuery('html, body').animate({scrollTop:targ}, 'normal'); 
	}
	else
	{
		//alert("NO SCROLL / Target is > \ntarg: " + targ + "\nwindow scroll: " + getScrollY());
	}
	
}

// utility function to get scroll position of window
function getScrollY() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}

// utility function for getting swf id
function getFlashMovie(movieName) {
  var isIE = navigator.appName.indexOf("Microsoft") != -1;
  return (isIE) ? window[movieName] : document[movieName];
}

