var groupSize = 3;
var btnGroup = new Array(groupSize); //array to hold buttons that belong in the same group
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
imgDir = "images/";
function swapImage(id) {
	var obj = document.getElementById(id);	
	obj.src = imgDir+id+"_focus.gif";
}
function restoreImage(id) {
	var obj = document.getElementById(id);	
	obj.src = imgDir+id+".gif";
}
function Exists(name) {
	for (i in btnGroup)
		if (i == name)
			return true;
	return false;
}
function MoveStart(obj) {
	hasText = /[a-zA-Z0-9]/.test(obj.value);
	if (obj.createTextRange && !hasText)//for IE browsers 
    { 
        //Creates a TextRange which encompasses the whole text area: 
        var oRange = obj.createTextRange(); 
         
        //Move the start of the Text Range to the end of the text area: 
        oRange.move("character",-2);        
        oRange.select(); 
    } 

    //put focus on the textarea: 
    obj.focus(); 
}
function RestoreButton(imgRef) {	
	var img = MM_findObj(imgRef);
	img.src = img.src.replace(/_focus/gi,""); //replaces the image's name		
}
function FocusButton(imgRef) {
	if (!btnGroup[imgRef]) {
		var img = MM_findObj(imgRef);
		img.src = img.src.replace(/\.gif/gi,"_focus.gif"); //replaces the image's name
	}
}
function SelectButton(imgRef,imgSrc) {
	//changes the selected button in 'selected' mode
	//changes all the other buttons in the same group to 'unselected' mode
	var img = MM_findObj(imgRef);
	var otherImg = ""; //stores other images in button group
	img.src = imgSrc; //change the source of the image clicked	
	for (i in btnGroup)  { //iterate through the array
		//change all images to 'unselected'
		if (btnGroup[i] && imgRef != i) {			
			
			otherImg = MM_findObj(i);
			otherImg.src = otherImg.src.replace(/_selected/gi,""); //replaces the image's name
			otherImg.style.cursor = "pointer";
			
		}			
		btnGroup[i] = 0;					
	}	
	btnGroup[imgRef] = 1; //set the clicked image to selected
	img.style.cursor = "default";
}
/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2001-4 by Sharon Paine 
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/
var wndo;
// Gallery INIT function. Place in onload event handler
function initScrollLayer() { 
	//special safari styles for layer that holds the gallery
	if (window.navigator.userAgent.toLowerCase().indexOf("safari")>1) {
		document.getElementById("hold").style.height=327+"px";	
		document.getElementById("hold").style.top=17+"px";	
		document.getElementById("hold").style.left=8+"px";	
	}
	//preload other images for site
	MM_preloadImages('images/site/sessiondetails_btn_focus.gif','images/site/sessionprices_btn_focus.gif','images/site/somethingspecial_btn_focus.gif','images/site/testimonials_btn_focus.gif','images/site/contactus_btn_focus.gif','images/site/home_btn_focus.gif','images/templatedesign_btn_selected.gif','images/templatedesign_btn_focus.gif','images/ecommercedesign_btn_focus.gif','images/ecommercedesign_btn_selected.gif','images/customdesign_btn_focus.gif','images/customdesign_btn.gif');
	// arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
	// if horizontal scrolling, id of element containing scrolling content (table?)
	wndo = new dw_scrollObj('wn', 'lyr1', 't1');	
	// pass id's of any wndo's that scroll inside tables
	// i.e., if you have 3 (with id's wn1, wn2, wn3): dw_scrollObj.GeckoTableBugFix('wn1', 'wn2', 'wn3');
  	dw_scrollObj.GeckoTableBugFix('wn'); 	
	//load images takes the following params: 
	//id name (or category name), it's same as the prefix of the images
	//path to large images
	//path to thumbnails
	//number of images for this category
	//extension for the images
	//preload mode: 1-preload large images only, 2-preload thumbnails only, 3-preload both, anything else-preload nothing

	//fill the gallery with the first category
	var section = GetSection("customdesign");
	FillGallery(section);

	MM_preloadImages('images/scrollarrow_up_focus.gif','images/scrollarrow_down_focus.gif');	
  
}
var wndo1;
function loadContentLayers() {
	MM_preloadImages('images/scrollarrow_up_focus.gif','images/scrollarrow_down_focus.gif');
	// arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
 	// if horizontal scrolling, id of element containing scrolling content (table?)
  	wndo1 = new dw_scrollObj('wncontent', 'lyr', null);

	// arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset
	// (x/y offsets of dragBar in track)
	wndo1.setUpScrollbar("dragBar1", "track1", "v", 1, 1);	
	
	// Read instructions if your scrolling layers are inside tables 
	
	// Scrollbars initially hidden in this example 
	dw_showLayers("scrollbar1");
}
function dw_showLayers() {
  if ( document.getElementById ) {
    var lyr, i;
    for (i=0; arguments[i]; i++) {
      lyr = document.getElementById( arguments[i] );
      lyr.style.visibility = "visible";
    }
  } 
}
function GetSection(def) {
	var section = def;	
	var location = new String(window.location);	
	if (location.indexOf("?section=templatedesign")>0) {
		section = "templatedesign";
		LoadImages("templatedesign",imgDir+"templatedesign/",imgDir+"templatedesign/thumbs/", 26,".jpg",2);
	}
	else if (location.indexOf("?section=ecommercedesign")>0) {
		section = "ecommercedesign";
		LoadImages("ecommercedesign",imgDir+"ecommercedesign/",imgDir+"ecommercedesign/thumbs/", 26,".jpg",2);
	}
	else
		LoadImages("customdesign",imgDir+"customdesign/",imgDir+"customdesign/thumbs/", 26,".jpg",2);
	return section;
	
}