// Services
// JavaScript Document
<!--

//CONFIG
 function doClear(theText) {
     if (theText.value == theText.defaultValue) {
         theText.value = ""
     }
 }
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

function changeImgSrc(obj,target) {
	if (document.getElementById){
		document.getElementById(obj).src = target;
		//alert(document.getElementById(obj).src);
	}
}

function SetItem(id) {
	var thumbClass;
	
	thumbClass = 'thumbOuter';
	if (gallery_view=='gallery:deep') { thumbClass += '2';}
	
	if ( id>=0 && id<items_count){
		// ***** reset current thumb style HERE

		//item class swap
		document.getElementById('thumb'+item_current).className = thumbClass;
		document.getElementById('itemOver'+item_current).className = 'mask';		
		
		document.getElementById('thumb'+id).className = thumbClass+'Current';
		document.getElementById('itemOver'+id).className = 'mask2';	

		//item onmouse code swap
		thumblink = document.getElementById('thumblink'+item_current);
		var mouseover_code 		= 'MM_showHideLayers(\'itemOver'+item_current+'\',\'\',\'show\')';
		var mouseout_code		= 'MM_showHideLayers(\'itemOver'+item_current+'\',\'\',\'hide\')';
		thumblink.onmouseover 	= new Function (mouseover_code);
		thumblink.onmouseout 	= new Function (mouseout_code);
		
		thumblink = document.getElementById('thumblink'+id);
		thumblink.onmouseover = '';
		thumblink.onmouseout = '';

		//itemover layer swap
		MM_showHideLayers('itemOver'+item_current,'','hide')
		MM_showHideLayers('itemOver'+id,'','show')



		//main image swap
		changeImgSrc('itemF',items[id][1]);
		
		//item text swap
		MM_setTextOfLayer('itemName','',unescape(items[id][0]));
		MM_setTextOfLayer('itemDescription','',unescape(items[id][2]));

		item_current = id;
		
	}
}

function replaceLinks() {
	for (i=0;i<items_count;i++) {
		var obj = document.getElementById('thumblink'+i);
		if (obj) {
			obj.href = 'javascript:;';
			var code = 'SetItem('+i+');';
			obj.onclick = new Function (code);
		}
	}
}

// OVERRIDE GOOGLE AUTOFILL
  if(window.attachEvent)
    window.attachEvent("onload",setListeners);

  function setListeners(){
    inputList = document.getElementsByTagName("INPUT");
    for(i=0;i<inputList.length;i++){
      inputList[i].attachEvent("onpropertychange",restoreStyles);
      inputList[i].style.backgroundColor = "";
    }
    selectList = document.getElementsByTagName("SELECT");
    for(i=0;i<selectList.length;i++){
      selectList[i].attachEvent("onpropertychange",restoreStyles);
      selectList[i].style.backgroundColor = "";
    }
  }

  function restoreStyles(){
    if(event.srcElement.style.backgroundColor != "")
      event.srcElement.style.backgroundColor = "";
  }
// -->