 $(document).ready(
 function() {
        $('#btnMysetting').click(
                function(){
                	    if(!navigator.cookieEnabled)
                	    {
                	    	alert('Please enable the cookie to perform the settings');
                	    }
                	    else
                	    {
				$('#mySetting').slideToggle("slow");
					doMySettingDefaults();
			    }
                        }
          );
   
    }
 );
 

	var strMySettingCookieName = "MySettings";
	var strFontSmall     = "11px";
	var strFontMedium    = "14px";
	var strFontLarge     = "18px";
	var strWidthStandard = "1001px";
	var strWidthWide     = "1250px";

$(document).ready(function() {	
	var mySettingCookie = GetCookie(strMySettingCookieName);
	if (mySettingCookie != null)
	{
		var arrCookieValues = unescape(mySettingCookie).split("|");

		// set font sizes
		if (arrCookieValues[0] != "undefined")
		{
			$(".ms-WPBody td").css({ fontSize: arrCookieValues[0]});
			$(".ms-WPBody").css({ fontSize: arrCookieValues[0] });
		}
		
		// set page width
		//if (arrCookieValues[1] != "undefined")
		//	$("#wrapper").css({ width: arrCookieValues[1] });
			
		// set the defaults
		doMySettingDefaults();
	};	
	
	
	$('#sFont').click(function(){
		if(!navigator.cookieEnabled)
  	        {
			alert('Please enable the cookie to perform the font setting');
	        }
	        else
                {
			$(".ms-WPBody td").css({ fontSize: strFontSmall });
			$(".ms-WPBody").css({ fontSize: strFontSmall });
			SaveSettings();
		}
	});
	$('#mFont').click(function(){
		if(!navigator.cookieEnabled)
		{
			alert('Please enable the cookie to perform the font setting');
		}
		else
                {
			$(".ms-WPBody td").css({ fontSize: strFontMedium });
			$(".ms-WPBody").css({ fontSize: strFontMedium });
			SaveSettings();
		}
	});
	$('#LFont').click(function(){
		if(!navigator.cookieEnabled)
		{
			alert('Please enable the cookie to perform the font setting');
		}
		else
                {
			$(".ms-WPBody td").css({ fontSize: strFontLarge });
			$(".ms-WPBody").css({ fontSize: strFontLarge });
			SaveSettings();
		}
	});
	$('#stdWidth').click(function(){
		if(!navigator.cookieEnabled)
		{
			alert('Please enable the cookie to perform the width setting');
		}
		else
                {
			$("#wrapper").css({ width: strWidthStandard });
			SaveSettings();
		}
	});
	$('#wWidth').click(function(){
		if(!navigator.cookieEnabled)
		{
			alert('Please enable the cookie to perform the width setting');
		}
		else
                {
			$("#wrapper").css({ width: strWidthWide });
			SaveSettings();
		}
	});

	$('#btnCloseSettings').click(function(){
	   $('#mySetting').slideToggle("slow");
	});
		
	$('#btnSaveSettings').click(function(){
	   SaveSettings();
   	   $('#mySetting').slideToggle("slow");
	});	
 });
 
function deletecookie(pid)
{

	var ids = GetCookie('QuickenPIDs')
	if (ids != null)
	{
		if (ids.indexOf("*"+pid) !=-1)
	    {

	        ids = ids.replace("*"+pid,"");
	 		doSetCookie('QuickenPIDs','*'+ids);
	 		return true;
	 	}
	 	else
	 		return false;
	}
	else
		return false;
}
//Check product id
function checkPID(productid)
{
	
	if(!navigator.cookieEnabled)
	{
		alert("Please enable the cookie to Add My Favourit Product");
	}
	else
	{ 
		var ids = GetCookie('QuickenPIDs')
		if (ids != null)
		{

		    if (ids.indexOf("*"+productid)==-1)
		    {
				doSetCookie('QuickenPIDs',ids+'*'+productid);
			return true;
		    }
		    else
			{

				return false;
			}
		}
		else
		{

			doSetCookie('QuickenPIDs','*'+productid);
			return true;
		}
	}
}

// Get the value of the cookie with the specified name.
function GetCookie(sName)
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0]) 
      return aCrumb[1];
  }

  // a cookie with the requested name does not exist
  return null;
}

// Delete the cookie with the specified name.
// The value of the cookie is unnecessary.
function DelCookie(sName)
{
  document.cookie = sName + "=; expires=Fri, 21 Dec 1976 04:31:24 GMT;";
}

function doSetCookie(sName, sValue)
{
	var exp = new Date().getTime();
	exp += 1000*60*60*24*31; // expire 1 month from now
	exp = new Date(exp);
  	document.cookie = sName + "=" + escape(sValue) + "; expires="+ exp.toGMTString();	
}

function PrintCookies()
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");

  alert(aCookie.length + " cookies");
  for (var i=0; i < aCookie.length; i++)
  {
    alert(i + " " + aCookie[i] + "<br>");
  }
}

function SaveSettings()
{
	var strCookieValue = "";
	var strFontSize, strWidth;

	var objFontSize;
	
	
	if (document.getElementById("sFont").checked == true)
		strFontSize = strFontSmall;
	if (document.getElementById("mFont").checked == true)
		strFontSize = strFontMedium;
	if (document.getElementById("LFont").checked == true)
		strFontSize = strFontLarge;

	if (document.getElementById("stdWidth").checked == true)
		strWidth = strWidthStandard;
	if (document.getElementById("wWidth").checked == true)
		strWidth = strWidthWide;

	strCookieValue = strFontSize + "|" + strWidth;	
	doSetCookie(strMySettingCookieName, strCookieValue);

}

function doMySettingDefaults()
{
	var mySettingCookie = GetCookie(strMySettingCookieName);
	if (mySettingCookie != null)	
	{
		var arrCookieValues = unescape(mySettingCookie).split("|");
		if (arrCookieValues[0] == strFontSmall) document.getElementById("sFont").checked = true;
		if (arrCookieValues[0] == strFontMedium) document.getElementById("mFont").checked = true;
		if (arrCookieValues[0] == strFontLarge) document.getElementById("LFont").checked = true;

		if (arrCookieValues[1] == strWidthStandard) document.getElementById("stdWidth").checked = true;
		if (arrCookieValues[1] == strWidthWide) document.getElementById("wWidth").checked = true;
	}
	else
	{
		document.getElementById("mFont").checked = true;
		document.getElementById("stdWidth").checked = true;
	}
}
//For + Sign and - sign
function AddFavorite(id)
{	
	var x;
	x=document.getElementById(id);
	
	if(checkProdID(id))
	{		
		x.src = "/_layouts/1033/images/quickenspecials/bullet_add.gif";
		x.title = 'Add to My Favourite';		
	}
	else
	{
 		x.src = "/_layouts/1033/images/quickenspecials/bullet_hdr_remove.gif";
 		x.title = 'Remove from My Favourite';
 	}
}

// For Normal Dotted
function NormalDotted(id)
{
	var x;
	x=document.getElementById(id);
	x.style.listStyleImage="url(/_layouts/1033/images/quickenspecials/bulleted.gif)"; 	
}



//Check product id
function checkProdID(productid)
{
	var ids = GetCookie('QuickenPIDs')
	if (ids != null)
	{
	    if (ids.indexOf("*"+productid)==-1)
	    {		
         	return true;
	    }
	    else
	    {
 		return false;
	    }
	}
	else
	{
	    	return true;
	}
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// jQuery code for Tabs
$(function() {
                $('#container-tabs').tabs({ fxFade: true, fxSpeed: 'fast' });
  });

/*Compare function scrips*/

	


/* For IE 6 */

$(document).ready(function(){
	$(".bullet_hdg li").hover(
		function(){ $("ul", this).fadeIn("fast");}, 
		function() { } 
	);
if (document.all) {
		$(".bullet_hdg li").hoverClass ("sfHover");
	}
});

$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);},
			function() { $(this).removeClass(c);}
		);
	});
};


function sendEmail()
{
	var address= window.location;	
	var subject = document.title;	
	window.open("mailto:?subject=" + subject + "&amp;body="+ address);
}

function PrintPage()
{
        
        var prtContent= "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"/_layouts/1033/Styles/reckon.css\" /></head><body> " + document.getElementById("divPrintArea").innerHTML +"</body></html>";
                
        var WinPrint = window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
        WinPrint.document.write(prtContent);
        WinPrint.document.close();
        WinPrint.focus();
	WinPrint.print();
	WinPrint.close();
}

function OpenRecommandWindow()
{
	window.open("http://www.quicken.com.au/prdcompare/prd_selector.html", "mywindow","width=1000,height=700");
}