/* 
  ------------------------------------------------
  JETENGINE Image & Meta Data Script
  Get your site revvin like a 747 jet engine
  C0D3D by Gunnar Leffler
  http://www.leftech.com
  Customized for leezoasis.com 12/2008
  (c) 2008 Gunnar Leffler - If you're not me, 
  you can't use this.
  ------------------------------------------------
*/

//START GLOBAL VARIABLES
var theBigPictureURL ="";
var lastNavPicture =  "img/portraits.jpg";
var curpic = "";
var ndx =0;

var slides;



var imgs = new Array();
var cf_indexer = 0;

var t,t1,t2,sto,ts;

var slideShowSpeed = 5000;
var crossFadeDuration = 3;//in seconds
var Pic = new Array();


//END GLOBAL VARIABLES

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-START SHOPPING CART CODE (PayPal)=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


function add_PP_item (description, price)
{
 txt = '';
 txt +='<center><img src = "img/products/buy.png" onmouseover = "this.src = \'img/products/buy2.png\'" onmouseout = "this.src = \'img/products/buy.png\'"  align = "center" border = "0" style="cursor: pointer;"'; 
 txt +='onclick = "document.getElementById(\'item_name\').value = \''+description+'\';';
 txt +='document.getElementById(\'price\').value = \'$'+price+'\';document.getElementById(\'cartform\').submit();" ></a><br>Purchase:<br> $'+price+'</center>';
 return txt;
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-END SHOPPING CART CODE=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-START NAVIGATION CODE=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

var navArray = new Array();
var mainNavURL = "";
var mainNavId = "";

function goSecure ()
{
 //alert (location.hostname); 
 var newURL;
 if (( location.protocol == "http:" ) || ( location.protocol == "http" ))
 {
   newURL = "https://"+location.hostname+location.pathname;
   window.location.href = newURL;
 }
}

function InitNav (nid)
{
navArray = new Array(
["N0","img/nav0.png","img/nav0.png"],
["N1","img/nav1.png","img/nav1a.png"],
["N2","img/nav2.png","img/nav2a.png"],
["N3","img/nav3.png","img/nav3a.png"],
["N4","img/nav4.png","img/nav4a.png"],
["N5","img/nav5.png","img/nav5a.png"],
["N6","img/nav6.png","img/nav6a.png"]

);




for (i = 0; i < navArray.length; i++)
  {
	  if (navArray[i][0] == nid) 
	  {
		mainNavURL = navArray[i][2];
		document.getElementById(navArray[i][0]).src = navArray[i][2];
		mainNavId = nid;
	  }
  }

}

function setOpacity(eid,value)
{
	document.getElementById(eid).style.opacity = value/25;
	document.getElementById(eid).style.filter = 'alpha(opacity=' + value*4 + ')';

}

function HiLite (nid)
{

 setOpacity (nid,22);
}

function unHiLite (nid)
{

 setOpacity (nid,25);

}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-END NAVIGATION CODE=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-START SLIDESHOW VARS AND CODE=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


var j = 0; // counter for slide show
var p; // 

function XfadeInit () 
{

Pic[0] = 'img/show1.jpg';
Pic[1] = 'img/show2.jpg';
Pic[2] = 'img/show3.jpg';
Pic[3] = 'img/show4.jpg';

p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad[i] = new Image();
preLoad[i].src = Pic[i];
}
}

function Xfade()
{
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 = Pic[j];
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t1 = setTimeout('Xfade()', slideShowSpeed);

}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-END SLIDESHOW VARS AND CODE=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-START DIVSCROLLER VARS AND CODE=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


function scrollDivLeft(id,step){
t  = 0;
document.getElementById(id).scrollLeft-=step
step--;
if (step > 0) t=setTimeout("scrollDivLeft('"+id+"',"+step+")",2); else document.getElementById(id).scrollLeft-=1;

}

function scrollDivRight(id,step){
t  = 0;
document.getElementById(id).scrollLeft+=step
step--;
if (step > 0) t=setTimeout("scrollDivRight('"+id+"',"+step+")",2); else document.getElementById(id).scrollLeft+=1;

}

function HscrollTo (id,pos)
{
clearTimeout(ts);
var step = (pos - document.getElementById(id).scrollLeft);
var step2 = step/15;

if (Math.abs(step) > 3) 
{
 document.getElementById(id).scrollLeft+=parseInt(step2);
 ts=setTimeout("HscrollTo('"+id+"',"+pos+")",5);
} else
{
 document.getElementById(id).scrollLeft= pos; 
}



}
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-END DIVSCROLLER VARS AND CODE=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-START STRING UTILITIES=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

function removeT (s)
{
  var i;
  var retval = "";
  for (i = 0; i < s.length; i++)
  {
	  if (s.charAt(i) != "t") retval += s.charAt(i);//s[i];
  }
 return retval;
}


function replaceT (s)
{
  var i;
  var retval = "";
  for (i = 0; i < s.length; i++)
  {
	  if (s.charAt(i) != "t") retval += s.charAt(i); else retval += "a";
  }
 return retval;
}

function removeChar (s,c)
{
  var i;
  var retval = "";
  for (i = 0; i < s.length; i++)
  {
	  if (s.charAt(i) != c) retval += s.charAt(i);//s[i];
  }
 return retval;
}

function CurrencyFormatted(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}

function gup( name ) //grab URL Parameters
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-END STRING UTILITIES=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-START COOKIE UTILITIES=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-END COOKIE UTILITIES=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-START PAYMENT UTILITIES=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


function populate_pay_areas ()
{
 var nomen = gup ('disc');
 var price = gup ('price');
 if (nomen.length > 1)
 {
   document.getElementById("nomen").innerHTML = unescape(nomen);
   document.getElementById("item_name").value = unescape(nomen);
 }
 if (price > 1)
 {
   document.getElementById('price').value = '$'+price;
   document.getElementById('price2').innerHTML = '$'+price;
 }


}

function contact_thanx ()
{
 var nomen = gup ('cmd');
 if (nomen == "thanks")
 {
   document.getElementById("thx").innerHTML = "<h2>Thanks for the feedback. I'll get back to you ASAP!</h2>";
 }
 if (nomen == "appt")
 {
   document.getElementById("appt").innerHTML = '<span class = "White12">Thank you for your scheduling request. I will contact you in the next 24 hrs to confirm. If you have any questions please call me @ 541-678-2108.</span>';
 }

}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-END PAYMENT UTILITIES=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-TESTIMONIALS=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

function get_random(maxNum)
{
  if (Math.random && Math.floor)
  {
    var ranNum= Math.floor(Math.random()*(maxNum));
    return ranNum;
  }
}


function getaQuote()
{
 if (Math.random && Math.floor)
  {
   var maxQuotes=4;
   var whichQuote=get_random(maxQuotes);

    var quote=new Array(maxQuotes);
     quote[0]="<i>&#8220; I just wanted to thank you so much... My father was so impressed with the massage. He said you had great technique and were very professional. He had a memorable experience. Thank you so much. My father has been through a lot this year. I'm just glad you gave me this opportunity to bring a little joy into his life. Thank you, thank you, thank you!!!!!&#8221</i><br /><br />-Paula<br />Bend, Oregon";
     quote[1]="<i>&#8220; I wanted to take some time to thank all you for making our event a success. Your ability to partner with us and offer your time, information and gifts are what made the fair an enjoyable experience... &#8221</i><br /><br />-Mark O.<br />Fairfield, Ca";
     quote[2]="<i>&#8220; I want to thank you for the great service you provided to our teachers and staff. I received many messages letting me know they were happy with the services and the staff would like to use you as a therapist in the future. Many thanks for working with us on our budget for teachers appreciation.&#8221</i><br /><br />Jessica R.<br />Sausilito, Ca";
     quote[3]="<i>&#8220; Great service and very professional. Thanks for taking the time and truly addressing my therapeutic needs. Never have I gotten sooo much relief from a massage.&#8221</i><br /><br />-Kevin<br />Sun River, Oregon";
     quote[4]="<i>&#8220; I am extremely happy and impressed with you. You posses an innate healing ability that cannot be taught in any school. That was the best massage I've ever had. I am recommending you to everyone I know. &#8221</i><br /><br />-Denise<br />Redmond, Oregon";
     return quote[whichQuote];
  }
}


//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-END TESTIMONIALS=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
