// JavaScript Document
//alert('heello');
popUpWin = 0;
function popUpWindow(URLStr, title, left, top, width, height,id)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, title, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollBars=no,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


function popUpWindowMenubar(URLStr, title, left, top, width, height,id)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, title, 'toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollBars=no,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


function popUpWindow_scroll(URLStr, title, left, top, width, height,id)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, title, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollBars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popUpWindowAll(URLStr, title, left, top, width, height,id)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, title, 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollBars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


	
	
function cNum(e) {
	var strCheck = '0123456789\b\t	 ';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode == 0 || whichCode == 13)
	{
		return true ;		
	}
	key = String.fromCharCode(whichCode);  // Get key value from key code
	if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
}

function cNumPhone(e) {
	var strCheck = '0123456789\b\t	 +()[]-';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode == 0 || whichCode == 13)
	{
		return true ;		
	}
	key = String.fromCharCode(whichCode);  // Get key value from key code
	if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
}

function block_click(disp)
{
	var list=document.getElementById(disp);
	var arr=document.getElementById("main").getElementsByTagName("div");
	if(list.style.display!="block")
	{
		for(i=0;i<arr.length;i++)
		{
			arr[i].style.display="none";
		}
			list.style.display="block";
	}
	else
	{
		list.style.display="none";
	}
}

// ==========================================================================
// Fuctions to mimic LTrim, RTrim, and Trim...

// Author          Aur�lien Tisn�(CS)
// Date            03 avr. 2003 23:11:39
// Last Update     $Date$
// Version         $Revision$
// ==========================================================================

// --------------------------------------------------------------------------
// Remove leading blanks from our string.

// I               str - the string we want to LTrim
// Return          the input string without any leading whitespace

// Date            03 avr. 2003 23:12:13
// Author          Aur�lien Tisn�(CS)
// --------------------------------------------------------------------------
function LTrim(str)
{
  var whitespace = new String(" \t\n\r");

  var s = new String(str);

  if (whitespace.indexOf(s.charAt(0)) != -1) {
    // We have a string with leading blank(s)...

    var j=0, i = s.length;

    // Iterate from the far left of string until we
    // don't have any more whitespace...
    while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
    j++;


    // Get the substring from the first non-whitespace
    // character to the end of the string...
    s = s.substring(j, i);
  }

  return s;
}

// --------------------------------------------------------------------------
// Remove trailing blanks from our string.

// I               str - the string we want to RTrim
// Return          the input string without any trailing whitespace

// Date            03 avr. 2003 23:13:50
// Author          Aur�lien Tisn�(CS)
// --------------------------------------------------------------------------
function RTrim(str)
{
  // We don't want to trip JUST spaces, but also tabs,
  // line feeds, etc.  Add anything else you want to
  // "trim" here in Whitespace
  var whitespace = new String(" \t\n\r");

  var s = new String(str);

  if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
    // We have a string with trailing blank(s)...

    var i = s.length - 1;       // Get length of string

    // Iterate from the far right of string until we
    // don't have any more whitespace...
    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
      i--;


    // Get the substring from the front of the string to
    // where the last non-whitespace character is...
    s = s.substring(0, i+1);
  }

  return s;
}

function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;

      }

// --------------------------------------------------------------------------
// Remove trailing and leading blanks from our string.

// I               str - the string we want to Trim
// Return          the trimmed input string

// Date            03 avr. 2003 23:15:09
// Author          Aur�lien Tisn�(CS)
// --------------------------------------------------------------------------
function trim(str)
{
  return RTrim(LTrim(str));
}

function change_display_image(class_name,id)
{
	document.getElementById(id.id).className=class_name;
}


function validate_partner_or_weathminder(form_name)
{
	if(ny.validateForm(form_name))
	{
		document.getElementById(form_name).submit();
	}
	else
	{
		return false;
	}
}


function set_check_hidden(val,id)
{
	if(id.checked==true)
	{
		document.getElementById('check_hidden_box').value+=val;
	}
	else
	{
		var str = document.getElementById('check_hidden_box').value;
		str = str.substr(0,str.length-1);
		document.getElementById('check_hidden_box').value=str;
	}
	return;
}

function PopupPic(sPicURL) 
{ 

 window.open(sPicURL, "fgdfg", "resizable=1,HEIGHT=150,WIDTH=275,top=300,left=400");
}

function imagePOP(sPicURL,width,heigth) 
{ 
 
 window.open(sPicURL, "fgdfg", "resizable=0,HEIGHT="+heigth+",WIDTH="+width+",top=300,left=400");
}

function div_show(id)
{
	document.getElementById(id).style.display='block';
}

function load_all_flash()
{
var so = new SWFObject("flash/custodianwealth_SPbanner.swf", "sub_flash", "747", "128", "8", "");
so.addParam("wmode", "transparent");
so.write("sub_flash");
}

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];}
}
function set_pdf_type(type)
{
    document.getElementById('jlf_pdf_type').value = type;
}

$(document).ready(function() {
    $("#home_inner").hide();
    $("#read_more").click(function(){
		$("#home_inner").slideToggle("slow",function(){
    });

	});
});
$(document).ready(function() {
  if(document.getElementById('video1') != undefined){
    video1 = jwplayer("video1").setup({
                  flashplayer: "http://player.exa.com.au/player/player.swf",
		    file: "http://cdn.exa.com.au/videos/bOh32yDj-851778.mp4",
                  image: "http://cdn.exa.com.au/thumbs/bOh32yDj-480.jpg",
                  components: {
                            controlbar:{
                                            position: "over",
                                            idlehide: true
                                         }
                                 },
                  backcolor: "#E2E6CF",
                  frontcolor: "#474246",
                  screencolor: "#ffffff",
                  height:297,
                  width:524,
                  menu:false,
                  wmode:"transparent",
		    skin:"http://player.exa.com.au/skins/fivewb/fivewb.xml",
		    "plugins": "gapro-1",
		    "gapro.accountid": "UA-3207766-44",		   
        	    "gapro.trackstarts": "true",
        	    "gapro.trackpercentage": "true",
        	    "gapro.tracktime": "true",
		    "gapro.debug": "false",
                  autostart: auto_start_flag,
                  events: {
                    onTime: function(event1) {
                       var src = www+'what_we_do.jpg';
                       $('#what_we_do').attr("src", src);
                      if(event1.position > 47 && event1.position < 50) {
                        src = www+'build_hover.jpg';
                        $('#build').attr("src", src);
                      }
                    if(event1.position > 50 && event1.position < 53) {
                        src = www+'build.jpg';
                        $('#build').attr("src", src);
                        src = www+'finance_hover.jpg';
                        $('#finance').attr("src", src);
                      }
                      if (event1.position > 53 && event1.position < 56) {
                        src = www+'finance.jpg';
                        $('#finance').attr("src", src);
                        src = www+'land_development_hover.jpg';
                        $('#land_development').attr("src", src);
                      }
                      if (event1.position > 56 && event1.position < 59) {
                          src = www+'land_development.jpg';
                         $('#land_development').attr("src", src);
                         src = www+'who_are_we_hover.jpg';
                         $('#who_are_we').attr("src", src);
                      }
                      if (event1.position > 59 && event1.position < 62) {
                         src = www+'who_are_we.jpg';
                         $('#who_are_we').attr("src", src);
                         src = www+'what_we_do_hover.jpg';
                         $('#what_we_do').attr("src", src);
                      }
                      }
                  }
                });
        }
});
function video(video_div, file, image,width,height) {
  if(document.getElementById(video_div) != undefined){
    video2 = jwplayer(video_div).setup({
                  flashplayer: "http://player.exa.com.au/player/player.swf",
                  file: file,
                  image: image,
                  components: {
                            controlbar:{
                                            position: "over",
                                            idlehide: true
                                         }
                                 },
                  backcolor: "#E2E5D0",
                  frontcolor: "#474246",
                  screencolor: "#ffffff",
                  height:height,
                  width:width,
                  menu:false,
                  wmode:"transparent",
                  allowfullscreen: "false"
                });
        }
}
