var address;  

function jsEmail(address) {
    //window.location = "mailto:" + address;
    window.location = address; 
}

/** Detect iphone and android and redirect to mobile site **/
var deviceIphone = "iphone";
var deviceIpod = "ipod";

//Initialize our user agent string to lower case.
var uagent = navigator.userAgent.toLowerCase();

//**************************
// Detects if the current device is an iPhone.
function DetectIphone()
{
   if (uagent.search(deviceIphone) > -1)
      return true;
   else
      return false;
}

//**************************
// Detects if the current device is an iPod Touch.
function DetectIpod()
{
   if (uagent.search(deviceIpod) > -1)
      return true;
   else
      return false;
}

//**************************
// Detects if the current device is an iPhone or iPod Touch.
function DetectIphoneOrIpod()
{
    if (DetectIphone())
       return true;
    else if (DetectIpod())
       return true;
    else
       return false;
}

var deviceAndroid = "android";

//**************************
// Detects if the current device is an Android OS-based device.
function DetectAndroid()
{
   if (uagent.search(deviceAndroid) > -1)
      return true;
   else
      return false;
}


//**************************
// Detects if the current device is an Android OS-based device and
//   the browser is based on WebKit.
function DetectAndroidWebKit()
{
   if (DetectAndroid())
   {
     if (DetectWebkit())
        return true;
     else
        return false;
   }
   else
      return false;
}

if(DetectAndroid() || DetectIphoneOrIpod()) {
	window.location = '/mobile';
}

$(document).ready(function() {
	/* SWF Object registration */
	var fo = new FlashObject("/swf/website-cactus-v1-loader.swf", "movie", "100%", "100%", "9.0", "#2d2d2f");
	fo.addParam("allowFullScreen", "true");
	fo.addVariable("applicationURL", "/swf/website-cactus-v1.swf");
	fo.addVariable("rootURL", "");
	fo.addVariable("configXML", "/xml/config-website-cactus.xml");
	fo.addVariable("defaultID", "");
	fo.addVariable("debugging", "0");
	fo.write("flash-container");
	sizeForBlog();
	$(window).resize(sizeForBlog);
});

function sizeForBlog() {
	$("#flash-container").css('height',function() {
		return $(window).height() - 60;
	});
}

function onBlogClick() {
	height = $(window).height() - 60;
    $('html,body').animate({scrollTop: height}, 200);
}