//*****The following function make it possible to have web standard popups**************************************************//
function strictNewWindow() {
  if (!document.getElementsByTagName('a')) return false;
  $('a.newwindow').click(function() {
		window.open($(this).attr('href'));
    return false;
	});
	$('.singleItem form').each(function(index){
  	if ($('form').attr('action').substring(0, 4) == "http") {
  	  $(this).attr('target','_blank');
  	}
  });
}
//*****Add swfobject flash call**************************************************//
function initializeFlash() {
	if (!document.getElementById('flash-content')) return false;
	var flashvars = {};
	var params = {wmode: 'transparent'};
	var attributes = {};
	attributes.id = "flash";
	swfobject.embedSWF("/shop/wp-content/themes/jbc/swf/flash-content.swf", "flash", "278", "275", "8.0.0", "/shop/wp-content/themes/jbc/swf/expressInstall.swf", flashvars, params, attributes);
}
//*****The following function make it possible to have rounded corner images**************************************************//
function roundedImage() {
  if (!document.getElementsByTagName('img')) return false;
  $('.post').each(function(index) {
    $(this).find('.entry-content img').addClass('corners iborder1 icolorffffff');
    var imageWidth = $(this).find('.entry-content img:first').width() + 45;
    var imageHeight = $(this).find('.entry-content img:first').height() - 30;
    if ($(this).hasClass('even')) {
      $(this).css('padding-right', imageWidth + 'px');
    }
    if ($(this).hasClass('odd')) {
      $(this).css('padding-left', imageWidth + 'px');
    }
    $(this).css('min-height', imageHeight + 'px');
  });
}

//*****Load all functions**************************************************//
$(document).ready(function(){
  strictNewWindow();
  initializeFlash();
  roundedImage();
});
