/*======= Variables for Portfolio Big Image  ======= */

var photos=new Array()
var photosText=new Array()
var which=0;

/*================================================== */

var query = '' + this.location;
query = query.substring((query.indexOf('?')) + 1);

function getQueryVariable(variable) {
  var vars = query.split("&");

  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
}

function changeContent(whichImg,which,img,activeTab){
	//alert(which);
	document.getElementById(whichImg).src=img;
	document.getElementById("tab-1").style.visibility="hidden";
	document.getElementById("tab-1").style.display="none";
	
	document.getElementById("tab-2").style.visibility="hidden";
	document.getElementById("tab-2").style.display="none";
	
	document.getElementById("tab-3").style.visibility="hidden";
	document.getElementById("tab-3").style.display="none";
	
	document.getElementById(activeTab).style.visibility="visible";
	document.getElementById(activeTab).style.display="inline";
}

/*======= Portfolio Gallery function  ======= */
var preloadedimages=new Array()
for (i=0;i<photos.length;i++){
preloadedimages[i]=new Image()
preloadedimages[i].src=photos[i]
}

function keeptrack(){

if (which==photos.length-1){
	document.getElementById('nextArrow').innerHTML= "<img src=\"images/next-off-arrow.gif\" border=\"0\" alt=\"Next\" />";
}else{
	document.getElementById('nextArrow').innerHTML= "<a href=\"#\" onClick=\"forward();return false\"><img src=\"images/next-on-arrow.gif\" alt=\"Next\" border=\"0\" />";
}

if (which==0){
	document.getElementById('prevArrow').innerHTML= "<img src=\"images/prev-off-arrow.gif\" border=\"0\" alt=\"Previous\" />";
}else{
	document.getElementById('prevArrow').innerHTML= "<a href=\"#\" onClick=\"backward(); return false\"><img src=\"images/prev-on-arrow.gif\" border=\"0\" alt=\"Previous\" />";
	}
}

function backward(){
	if (which>0){
		which--
		document.photoslider.src=photos[which]
		if(document.getElementById("store-desc")){
			document.getElementById("store-desc").innerHTML = photosText[which];
			}
		keeptrack()
	}
}

function forward(){
	if (which<photos.length-1){
		which++
		document.photoslider.src=photos[which]
		if(document.getElementById("store-desc")){
			document.getElementById("store-desc").innerHTML = photosText[which];
			}
		keeptrack()
	}
}


function setCurrent(){
	//alert(document.images.photoslider.src);
	var whichPhoto = Number(getQueryVariable("show") - 1);
	if(whichPhoto && whichPhoto!="" && photos[whichPhoto]){
		which = whichPhoto
	}else{
		which = 0;
	}
	document.photoslider.src=photos[which];
	if(document.getElementById("store-desc")){
		document.getElementById("store-desc").innerHTML = photosText[which];
		}
	keeptrack();

}
/*======= Portfolio Gallery function  ======= */

function showTip(which){
	if(document.getElementById(which)){
			document.getElementById(which).style.display="inline";
		}	
	}

function hideTip(which){
	if(document.getElementById(which)){
			document.getElementById(which).style.display="none";
		}	

	}
	

/* ========================== Open Chat Window =============== */
function showChatWindow(){
	window.open('live-chat.html','','height=430,width=550,resizable=yes,scrollbars=yes,menubar=no,toolbar=no,left=200,top=130,screenX=200,screenY=130');
}
