
var slideShowSpeed = 30000;

var crossFadeDuration = 3

var t
var multi = Pic.length-1;
var j = Math.round(Math.random()*multi);
var p = Pic.length

var t2
var multi2 = Prev.length-1;
var j2 = Math.round(Math.random()*multi2);
var p2 = Prev.length 

var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}

var preLoad2 = new Array()
for (a = 0; a < p2; a++){
   preLoad2[a] = new Image()
   preLoad2[a].src = Prev[a]
}

function runSlideShow(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()      
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}

function runPreview(){
	  if (document.all){
	     document.images.preview.style.filter="blendTrans(duration=2)"
	     document.images.preview.style.filter="blendTrans(duration=crossFadeDuration)"
	     document.images.preview.filters.blendTrans.Apply()      
	  }
	  document.images.preview.src = preLoad2[j2].src 
	  if (document.all){
	     document.images.preview.filters.blendTrans.Play()
	  }
	  j2 = j2 + 1
	  if (j2 > (p2-1)) j2=0
	  t2 = setTimeout('runPreview()', 6235)
}


function tab( page , tab , estate ) {
	if (!tab) {
		if (!estate) {
			window.location = 'index.php?cID='+page;
		} else {
			window.location = 'index.php?cID='+page+'&estate='+estate;
		}
	} else {
		if (!estate) {
			window.location = 'index.php?cID='+page+'&pID='+tab;
		} else {
			window.location = 'index.php?cID='+page+'&pID='+tab+'&estate='+estate;
		}
	}
}

function estate( object ) {
	window.location = 'index.php?cID=estates.php&estate='+ object;
}

function XMLRequest() {
		try{
		// Opera 8.0+, Firefox, Safari
		return new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			return new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				return new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser does not support XML HTTP Requests");
				return false;
			}
		}
	}
}

function getBlocks() {
var subdiv = document.getElementById('subdiv').value;
var stage = document.getElementById('ValStage').value;

var Request = XMLRequest();  // The variable that makes Ajax possible!

	// Create a function that will receive data sent from the server
	Request.onreadystatechange = function(){
		if(Request.readyState == 4){
		values = Request.responseText.split('!!**!!');
		document.getElementById('retrieved_blocks').innerHTML = values[0];
		eval(values[1]);
		}
	}
	Request.open("GET", "modules/admin/scripts/getBlocks.php?subdivision="+subdiv+"&stage="+stage, true);
	Request.send(null); 
}

function getStages() {
var subdiv = document.getElementById('subdiv').value;

var Request = XMLRequest();  // The variable that makes Ajax possible!

	// Create a function that will receive data sent from the server
	Request.onreadystatechange = function(){
		if(Request.readyState == 4){
		values = Request.responseText.split('!!**!!');
		document.getElementById('retrieved_stages').innerHTML = values[0];
		eval(values[1]);
		}
	}
	Request.open("GET", "modules/admin/scripts/getStages.php?subdivision="+subdiv, true);
	Request.send(null); 
}

function print_content(obj, title)
{ 
  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25"; 
  var content = document.getElementById(obj).innerHTML; 
  var today = new Date()
  var h = (today.getHours() < 10) ? '0'+today.getHours() : today.getHours();
  var m = (today.getMinutes() < 10) ? '0'+today.getMinutes() : today.getMinutes();
  var s = (today.getSeconds() < 10) ? '0'+today.getSeconds() : today.getSeconds();
  
  var day = today.getDate();
  var month = today.getMonth();
  var year = today.getYear();
  title = "L. Bisinella Developments - Online Printout";
  var date_out = day+"/"+(month+1)+"/"+year+" "+h+":"+m+":"+s;
  var docprint=window.open("","",disp_setting); 
   docprint.document.open(); 
   docprint.document.write('<html><head><title>'+title+'</title>'); 
   docprint.document.write('<link rel="stylesheet" href="includes/bisinella.css" type="text/css" />');
   docprint.document.write('<style type="text/css">.style1 {	color: #333333;	font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 9px;}.style2 {color: #333333; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; }.style3 {font-size: 9px}.style4 {font-family: Verdana, Arial, Helvetica, sans-serif; color: #333333;}.style5 {color: #999999};</style>');
   docprint.document.write('</head><body onLoad="self.print();self.close();">');
  	docprint.document.write('<table width="720" border="0" cellspacing="0" cellpadding="0"><tr><td width="200" align="left" valign="bottom"><img src="includes/images/print_logo.jpg" width="185" height="98" /></td><td width="333" height="99"><p class="style1">&nbsp;</p>    </td><td width="187" align="left" valign="top"><table width="91%" border="0" align="right" cellpadding="0" cellspacing="0"><tr><td height="51" colspan="2"><p class="style1">L.Bisinella Developments P/L<br />195 Forest Road Lara VIC 3212</p>          </td></tr><tr><td width="6%"><span class="style1">p.<br />f.<br />&nbsp;<br />&nbsp;</span></td><td width="94%"><span class="style1">(03) 5274 1643</span><br /><span class="style1">(03) 5274 1914</span><br /><span class="style1">sales@lbdevelopments.com.au<br />www.lbdevelopments.com.au</span></td></tr></table></td></tr><tr><td height="20" colspan="3" align="left" valign="middle"><img src="includes/images/print_line.jpg" width="721" height="1" /></td></tr><tr><td height="19" colspan="3" align="left" valign="top">&nbsp;</td></tr><tr>');
   docprint.document.write('<td height="136" colspan="3" align="left" valign="top"><p>'+ content +'</p><p>&nbsp;</p><p>&nbsp;</p></td>');          
   docprint.document.write('</tr><tr><td height="77" colspan="3" align="left" valign="bottom"><span class="style2">This printout was generated on: <span id="TodaysDateTime">'+date_out+'</span> AEDT <br />All efforts have been made to ensure the printed details are true and accurate at the time of print.</span></td></tr></table></body></html>'); 
  // docprint.document.close(); 
   docprint.focus(); 
}

function open_sort() {
	var disp_setting="toolbar=yes,location=no,directories=no,menubar=no,"; 
      disp_setting+="scrollbars=no,width=450, height=350, left=100, top=25"; 
	window.open('modules/admin/menu_mod.php','',disp_setting);
}