//Initialize our user agent string to lower case.
var uagent = navigator.userAgent.toLowerCase();
var engineWebKit = "webkit";
var deviceAndroid = "android";

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;
}


//**************************
// Detects if the current device is an Android OS-based device.
function DetectAndroid()
{
   if (uagent.search(deviceAndroid) > -1)
      return true;
   else
      return false;
}
function DetectWebkit()
{
   if (uagent.search(engineWebKit) > -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;
}



$(document).ready(function() {
	var viewportWidth = $(window).width();
	var viewportHeight = $(window).height();
	var flashvars = {
		};
		var params = {
			menu: "false",
			scale: "noScale",
			quality: "low",
			allowFullscreen: "true",
			allowScriptAccess: "always",
			bgcolor: "#000000"
		};
		var attributes = {
			id:"xx"
		};
		swfobject.embedSWF("waves.swf", "waves", "100%", "100%", "10.0.0", "expressInstall.swf", flashvars, params, attributes);
	//console.log("viewportWidth:viewportHeight > "+viewportWidth+":"+viewportHeight);
	var sectionPadding=(viewportHeight-180)/22;
	if(viewportWidth<500 ){
			$("body").css('font-size',10);
	}
	if(DetectAndroidWebKit() || DetectIphoneOrIpod() ){
			$("body").css('font-size',30);
	}
	
	$(".section > h2").css('padding-top',sectionPadding);
	$(".section > h2").css('padding-bottom',sectionPadding);
	$('.section > #scontent').hide();
	$('#cform > #cform-body').hide();
	$(".section > h2").click(
				function(){
					$('.section > #scontent').hide(200);
					$('#cform > #cform-body:visible').hide();
					if(!$(this).next().is(":visible")){
						$(this).next().delay(400).show(500,function() {
						});
					};
					//console.log("click1");
				});
		$("#cform > h3").click(
				function(){
										
						$(this).next().delay(400).toggle(500,function() {
							//$(this).css('padding-bottom','.2em');	 
						});
					
					//console.log("click1");
				});			
	$('#header > h1').click(function() {
		$('.section > #scontent').hide(200);		 
	});			
});
 
 
 

