

$(document).ready(function() {


$('.scrollWrapper').hover(function() { 
$('.arrowLeft').animate({opacity: "1"}, 350);
$('.arrowRight').animate({opacity: "1"}, 350);
},
function() {
$('.arrowLeft').animate({opacity: "0"}, 350);
$('.arrowRight').animate({opacity: "0"}, 350);
});


var viewportwidth;
var viewportheight;

if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }


var stripWidth;
stripWidth = viewportwidth - 193;
stripWidth = stripWidth.toString();
stripWidth = stripWidth + 'px';

var stripeWidth;
 stripeWidth = $(".redStripe_footer").width();
 stripeWidth = stripeWidth - 193;
 stripeWidth = stripeWidth.toString();
 stripeWidth = stripeWidth + 'px';



if (get_cookie("alreadyVisited") =="") {

document.cookie="alreadyVisited=1";

 $(".redStripe_footer").animate({ width: "0%" }, 0);
 $(".redStripe_footer").animate({ width: "0%" }, 2200);
 $(".redStripe_footer").animate({ opacity: "1" }, 0);
 $(".redStripe_footer").animate({ width: "100%" }, 2000);

 
  
 $(".redStripe").animate({ width: "0%" }, 0);
 $(".redStripe").animate({ width: "0%" }, 2400);
 $(".redStripe").animate({ opacity: "1" }, 0);
 $(".redStripe").animate({ width: stripeWidth }, 2000);
    
 $(".redStripe2").animate({ width: "0%" }, 0);
 $(".redStripe2").animate({ width: "0%" }, 2400);
 $(".redStripe2").animate({ width: "100%" }, 2000);
 
  $(".redStripe_footer_sm").animate({ width: "0%" }, 0);
  $(".redStripe_footer_sm").animate({ width: "0%" }, 2200);
  $(".redStripe_footer_sm").animate({ width: "100%" }, 2000);

  var isiPad = navigator.userAgent.match(/iPad/i) != null;
  var isiPhone = navigator.userAgent.match(/iPhone/i) != null;


var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
	    }
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}

if ( MM_FlashCanPlay ) {
	 $("#logoFlash").flashembed("swf/logo.swf", {
	wmode: 'transparent',
	onFail: function() { $("#logoFlash").replaceWith('<img src="img/redline_100.png" />'); }
	});

} else{
    $("#logoFlash").replaceWith('<img src="img/redline_100.png" />');
}



if( isiPad || isiPhone ) {
    $("#logoFlash").replaceWith('<img src="img/redline_100.png" />');
}

if( !isiPad && !isiPhone) {

  $("#logoFlash").flashembed("swf/logo.swf", {
	wmode: 'transparent',
	onFail: function() { $("#logoFlash").replaceWith('<img src="img/redline_100.png" />'); }
	});

}

}
else {


 $(".redStripe").css({ opacity: "1" });
 $(".redStripe").css({ width: stripeWidth });
 
  $(".redStripe_footer").css({ opacity: "1" });
  $(".redStripe_footer").css({ width: "100%" });
  
  
 $(".redStripe2").css({ width: "100%" });
  $(".redStripe_footer_sm").css({ width: "100%" });
  
  $("#logoFlash").replaceWith('<img src="img/redline_100.png" />');

}

$(window).resize(function() {
 stripeWidth = $(".redStripe_footer").width();
 stripeWidth = stripeWidth - 193;
 stripeWidth = stripeWidth.toString();
 stripeWidth = stripeWidth + 'px'
 $(".redStripe").css({ opacity: "1" });
 $(".redStripe").css({ width: stripeWidth });
});


});

//Get cookie routine by Shelley Powers 

function onFail() {   $("#logoFlash").replaceWith('<img src="img/redline_100.png" />'); }

function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    // if cookie exists
    if (offset != -1) { 
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1) end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}
