/* 
  ------------------------------------------------
  JETENGINE Image & Meta Data Script
  C0D3D by Gunnar Leffler
  http://www.leftech.com
  Version: 1.0 for ecuadorbeachfront.com
  ------------------------------------------------
*/

//START GLOBAL VARIABLES
var theBigPictureURL ="";
 var slides = new Array(
"img/ecuador1.jpg",
"img/ecuador2.jpg",
"img/ecuador3.jpg",
"img/ecuador4.jpg",
"img/ecuador5.jpg",
"img/ecuador6.jpg",
"img/ecuador7.jpg"
);

var imgs = new Array();


var t,t1,t2;
//END GLOBAL VARIABLES

function ChangePic() 
{ 
   var selection = arguments[0];
   var link = "";
   var text = "";
   var FILENAME = "";
   var Metadata; 

switch (selection){
/*------------
  COCO BEACH 1
  ------------*/
case "coco1.jpg": 
 FILENAME = "img/coco1.jpg";
 text   = "<center>The small upward sweep of elevation insures lot owners spectacular views!</center>";
break;
case "coco2.jpg": 
 FILENAME = "img/coco2.jpg";
 text   = "<center>This could be your backyard!</center>";
break;
case "coco3.jpg": 
 FILENAME = "img/coco3.jpg";
 text   = "<center>To enhance and preserve the views, all lots have underground electricity.</center>";
break;
case "coco4.jpg": 
 FILENAME = "img/coco4.jpg";
 text     = "<center>The Master Development Plan. Click Image for a detailed view.</center>";
 link     = "lot_plan.html";
break;
case "coco5.jpg": 
 FILENAME = "img/coco5.jpg";
 text   = "<center>One of the many activities that are literally at your doorstep.</center>";
break;
case "coco6.jpg": 
 FILENAME = "img/coco6.jpg";
 text   = "<center>Spectacular sunrises/sets included.</center>";
break;
case "coco6.jpg": 
 FILENAME = "img/coco6.jpg";
 text   = "<center>Spectacular sunrises/sets included.</center>";
break;
case "coco7.jpg": 
 FILENAME = "img/coco7.jpg";
 text   = "<center>Map of the Ecuador coast.</center>";
 link     = "img/coast.jpg";
break;
case "coco8.jpg": 
 FILENAME = "img/coco8.jpg";
 text   = "<center>Coco Beach Price List. <a href = \"#\" onClick = \"javascript:ShowTheBigPicture();\"> Click</a> the picture for the full list.</center>";
 link     = "list.htm";
break;
case "coco9.jpg": 
 FILENAME = "img/coco9.jpg";
 text   = "<center>Coco Beach Village is located between the river and the point.</center>";
 link     = "img/coco9.jpg";
break;
case "flyer3.jpg": 
 FILENAME = "img/flyer3.jpg";
 text   = "<center>Limited Time Offer! <a href = \"#\" onClick = \"javascript:ShowTheBigPicture();\"> Click</a> the picture for more details</center>";
 link     = "flyer.htm";
break;
case "flyer4.jpg": 
 FILENAME = "img/flyer4a.jpg";
 text   = "<center>Introductory Offer! <a href = \"#\" onClick = \"javascript:ShowTheBigPicture();\"> Click</a> the picture for more details</center>";
 link     = "flyer.htm";
break;

/*------------
  MATAL
  ------------*/
case "prop2_p1.jpg": 
 FILENAME = "img/prop2_p1.jpg";
 text   = "<center>The small upward sweep of elevation insures lot owners spectacular views!</center>";
break;
case "prop2_p2.jpg": 
 FILENAME = "img/prop2_p2.jpg";
 text   = "<center>The small upward sweep of elevation insures lot owners spectacular views!</center>";
break;

/*------------
  PROPERTY 3
  ------------*/
case "prop3_p1.jpg": 
 FILENAME = "img/prop3_p1.jpg";
 text   = "<center>The small upward sweep of elevation insures lot owners spectacular views!</center>";
break;
case "prop3_p2.jpg": 
 FILENAME = "img/prop3_p2.jpg";
 text   = "<center>The small upward sweep of elevation insures lot owners spectacular views!</center>";
break;
case "prop3_p3.jpg": 
 FILENAME = "img/prop3_p3.jpg";
 text   = "<center>The small upward sweep of elevation insures lot owners spectacular views!</center>";
break;
case "prop3_p4.jpg": 
 FILENAME = "img/prop3_p4.jpg";
 text   = "<center>The small upward sweep of elevation insures lot owners spectacular views!</center>";
break;

default : client="SCRIPT ERROR: Selection Not found. Contact Leffler Consulting for Help. http://www.leftech.com";
}


document.getElementById('MainProduct').src = FILENAME;
document.getElementById('ProductText').innerHTML = text;
if (link != "")
{
 theBigPictureURL = link;
 document.getElementById('MainProduct').alt = "Click Here For a More Detailed View";
} else
{
 theBigPictureURL = link;
 document.getElementById('MainProduct').alt = link;
} //because in this case link = ""

}

function ShowTheBigPicture () //How very AJAXY
{
if (theBigPictureURL != "")
{
window.open(theBigPictureURL,'mywindow','width=900,height=700,toolbar=no, location=yes,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no, resizable=yes');
}


}

function setOpacity(value)
{
	document.getElementById('slidefront').style.opacity = value/25;
	document.getElementById('slidefront').style.filter = 'alpha(opacity=' + value*4 + ')';

}

function preload ()
{
 for (var i = 0;i < slides.length;i++) 
 {
  imgs[i] = new Image ();
  imgs[i].src = slides[i];
 }
}

function FadeOut()
{
 var o =arguments[0];
 if (o != 0)
 {
  setOpacity(o);
  o--;
  t = setTimeout('FadeOut('+o+');',o*5);
 }

}

function SwapImages ()
{
 var cf_indexer =arguments[0];
 window.clearTimeout(t2);

 document.images.slidefront.src = imgs[cf_indexer].src;
 window.status = cf_indexer;
 cf_indexer++;
 if (cf_indexer >= slides.length) cf_indexer = 0;
 document.getElementById('slideback').background = slides[cf_indexer];
 FadeOut(25);
 t1=setTimeout('SwapImages2('+cf_indexer+')',5000);
}

function SwapImages2 ()
{
 var cf_indexer = arguments[0];
 window.clearTimeout(t1);

 document.images.slidefront.src = imgs[cf_indexer].src;
 window.status = cf_indexer;
 cf_indexer++;
 if (cf_indexer >= slides.length) cf_indexer = 0;
 document.getElementById('slideback').background = slides[cf_indexer];
 FadeOut(25);
 t2=setTimeout('SwapImages2('+cf_indexer+')',5000);
}

function CrossFade ()
{
 preload();
 t=setTimeout('SwapImages(0)',5000);
}


function ShowBox()
{
 var box = document.getElementById('Found').value;
 if (box == "Other")
 {
  document.getElementById('Other1').innerHTML = 'Please Describe:';
  document.getElementById('Other2').innerHTML = '<input type="text" name="Other Source" size="28">';
 } else
 {
  document.getElementById('Other1').innerHTML = '';
  document.getElementById('Other2').innerHTML = '';
 }
 
}





