function cl(msg){
	if(typeof(console) != 'undefined'){
		console.log(msg);
	}
}

function getWindowDimensions() {
  var myWidth = 0, myHeight = 0, myDimensions = {};
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  myDimensions = {w: myWidth, h: myHeight};
  return myDimensions;
}

jQuery.noConflict(); 

jQuery(document).ready(function(){
	
	// Product images
	
	jQuery('.products-grid td a').hover(
		function(){
			jQuery(this).find('.product-info').slideDown(150,'easeOutSine');
		},
		function(){
			jQuery(this).find('.product-info').slideUp(150);
		}
	);
	
	$$('dd.option-monogram-child').invoke('insert', '<a href="../media/upload/monogram.jpg" target="_blank" title="See Full Size Image"><img src="../media/upload/monogram_small.jpg" /></a>');
	$$('dt.option-first').invoke('insert', {
		before: '<dt class="option-initial">Initials</dt>' 
	});
	$$('dd.option-last').invoke('insert', {
		after: '<dt class="option-location">For this style, the last initial will be placed in the center of the monogram. Letters only.</dt>' 
	});
	
	if($$('.slideshow').length > 0){
		jQuery('.slideshow').cycle({
			fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		});
		jQuery('.slideshow-wrapper .slideshow').cycle({
			fx: 'fade',
			timeout: 3000
		});
	}

	jQuery("button span").wrap("<span class=\"glass\"></span>");

	TopUp.images_path = "media/press/";
	
	if($('press_content')){
	    
	    var myDimensions = getWindowDimensions();
	    var zoomedHeight = myDimensions.h - 50;
        cl(zoomedHeight);
        jQuery('.te_controls').hide();
            jQuery('#top_up').mouseenter(function(){
                jQuery('.te_controls').show();
            }).mouseleave(function(){
                jQuery('.te_controls').hide();
        });
	    
	    TopUp.addPresets({
	        "#press_content a": {
	            title: "Gallery {alt} ({current} of {total})",
	            height: zoomedHeight + 'px',
	            group: "press",
	            readAltText: 1,
                // resizable: 1,
                shaded: 1
	        }
	    });
	}
	
});


