function makeFontBig()
{
    var currentFontSize = $('#content').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.2;
    $('#content').css('font-size', newFontSize);
    return false;
}

function makeFontSmall()
{
   var currentFontSize = $('#content').css('font-size');
   var currentFontSizeNum = parseFloat(currentFontSize, 10);
   var newFontSize = currentFontSizeNum*0.8;
   $('#content').css('font-size', newFontSize);
   return false;
}  

function showEmailModal()
{
   var message = $('#emailToFriend').clone().removeClass("hidden");
   $.blockUI({ message: message, css: { width: '300px', height: '350px' } });
}

function unBlock()
{
   $.unblockUI(); 
   return false;    
}

// The submitETF function submits the contents of the email-to-a-friend form via AJAX to the postback controller
function submitETF(tf)
{
   // Define a JSON key/value array and store the user entered details there
   var parameters = {};
   parameters['your_name'] = tf.your_name.value;
   parameters['friend_name'] = tf.friend_name.value;
   parameters['email'] = tf.friend_email.value;
   parameters['message'] = tf.friend_message.value;
   parameters['url'] = document.location.href;

   var url = base_url + "index.php/postback/emailtofriend";
   
   // Send the parameters to our postback method.
   $.post(url, parameters,function(data)
   {
      if(data.message == "OK")
      {
         alert("Thank you.  Your message has been sent.");
      }
      else
      {
         alert("Sorry, your message could not be sent.  Please try again later.");
      }
      
      unBlock();
      
   },"json");       
}

function validateETF(tf)
{
   if($(tf).validate().form())
      submitETF(tf);
      
   return false;
}

function showSignupForm()
{
   var message = $('#signup').clone().removeClass("hidden");
	var rand_no = Math.random() * 10000;
   $(message).find("#img_captcha").attr("src", base_url + "securimage/securimage_show.php?r=" + rand_no);
   
   $.blockUI({ message: message, css: { width: '600px', top: '5%'  } });
}

function validateSignup(tf)
{
   if($(tf).validate().form())
      submitSignup(tf);
      
   return false;
}

// The submitSignup function submits the contents of the registration form via AJAX to the postback controller
function submitSignup(tf)
{
   // Get the selected nature of business option.
   var len = tf.nature_of_business.length;
   var nature_of_business;

   for (i = 0; i <len; i++) 
   {
      if (tf.nature_of_business[i].checked) 
      {
         nature_of_business = tf.nature_of_business[i].value;
      }
   } 
   
   // Define a JSON key/value array and store the user entered details there
   var parameters = {};
   parameters['name'] = tf.name.value;
   parameters['company_name'] = tf.company_name.value;
   parameters['address'] = tf.address.value;
   parameters['suburb'] = tf.suburb.value;
   parameters['state'] = tf.state.options[tf.state.selectedIndex].value;
   parameters['postcode'] = tf.postcode.value;
   parameters['phone'] = tf.phone.value;
   parameters['email'] = tf.email.value;
   parameters['nature_of_business'] = nature_of_business;
   parameters['nature_of_business_other'] = tf.nature_of_business_other.value;
   parameters['captcha_code'] = tf.captcha_code.value;
   
   if(tf.subscribe.checked)
   	parameters['subscribe'] = 1;
   else
   	parameters['subscribe'] = 0;
   
   var url = base_url + "index.php/postback/register";
   
   // Send the parameters to our postback method.
   $.post(url, parameters,function(data)
   {
      if(data.message == "OK")
      {
         alert("Thank you.  Your information has been sent to our staff and we will respond as soon as possible.");
      }
      else
      {
         alert("Sorry, your message could not be sent. " + data.message);
      }
      
      unBlock();
      
   },"json");       
}

function showVideo(videoID)
{
   var message = $('#videoWatcher').clone().removeClass("hidden");
   var message_html = $(message).html();
   message_html = message_html.replace(/\[VIDEOID\]/g, videoID);
   $(message).html(message_html);
   $.blockUI({ message: message, css: { width: '430px', height: '400px', top: '5%' } });	
}

function changeArticleCategory()
{
	var category_id = $("#volume_category").val();
	if(category_id != "")
	{
		window.location = base_url + "index.php/articles/categories/17/1/Media Glance/" + category_id;
	}
}

function changeBanner(offset)
{
	var x = 0;
	
	$("#banners li").each(function() 
	{
		if(x == offset)
			$(this).attr("class", "");
		else
			$(this).attr("class", "hidden");
			
		x = x + 1;
	})
	
	var x = 0;
	
	$("#carousel li").each(function() 
	{
		if(x == offset)
			$(this).find("img").attr("class", "active");
		else
			$(this).find("img").attr("class", "");
			
		x = x + 1;
	})	
}

function changeBanner2(offset)
{
	var x = 0;
	
	$("#banners li").each(function() 
	{
		if(x == offset)
		{
			$(this).css("display", "list-item");
			$(this).css("opacity", "1.0");
		}
		else
			$(this).css("display", "none");
			
		x = x + 1;
	})
}



