// JavaScript Document

//<![CDATA[
var lastImg=0;
function MM_findObj(n, d) { //v4.01
  var p,i,x;  
 
  if (!n)
  	return null;
  if(!d) d=document; 
     x=d.getElementById(n); return x;
}

function openMenu(id) {
	
	var elem = MM_findObj(id);
   
	if ((elem != null) &&elem.className !='openMenu')
	 	elem.className = 'openMenu';
	 
	
}

function closeMenu(id) {
	
	var elem = MM_findObj(id);
	
	if (elem.className != 'closeMenu')
		elem.className = 'closeMenu';
	
}

function SetActive(id) {
	var elem = MM_findObj(id);
	elem.style.color = "#cbb96f";
	
}

function SetOpen(id) {
	var elem = MM_findObj(id);
	elem.className = "openMenu";
	elem.onmouseout = openMenu;
	
}


function displaySeries(s, k) {

	
	//alert(series.imgsrc[k].file);
	var im = document.getElementById('bigImage');
	im.src = s.imgsrc[k].file;
	im.width= s.imgsrc[k].width;
  
	if (series.title[k].length <= 0)
		return;
   document.getElementById('title').innerHTML = series.title[k]; 
   document.getElementById('description').innerHTML = series.description[k];
   document.getElementById('dimension').innerHTML = series.dimension[k];
}
function updateImage(series, index) {
		    
			if (index < 0)
				index = series.imgsrc.length -1;
			else if (index > series.imgsrc.length-1) {
				 document.getElementById('bigImage').removeAttribute('width');
				index  = 0;
			}
			lastImg = index;
			displaySeries(series, index);
		
		
}

function getData() {
	var str = location.search.slice(1);
	str = unescape(str);
	var data = str.split(/[&=]/g);	
	lastImg = data[0];
	return(lastImg);
	
	
	//alert(lastImg);
}

// Example:
// simplePreload( '01.gif', '02.gif' ); 
function simplePreload()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}
 simplePreload('images/mainImage.jpg','images/logo-interior.png');
 
 function highlightSection(i) {
	 var id = document.getElementById(i);
	 id.style.color = "#6485a9";
 }
// Example:
// simplePreload( '01.gif', '02.gif' ); 
function simplePreload()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}




function DisplayStatement(id){
	var elem = MM_findObj(id);
	
	if (elem.style.display == "none")
		elem.style.display = "block";
	
}
function HideStatement(id){
	var elem = MM_findObj(id);
	
	if (elem.style.display == "block")
		elem.style.display = "none";
	
}

var allHTMLTags = new Array();
function getElementByClass(theClass) {
//Create Array of All HTML Tags
var allHTMLTags=document.getElementsByTagName('ul');
//Loop through all tags using a for loop
for (i=0; i<allHTMLTags.length; i++) {
//Get all tags with the specified class name.
	if (allHTMLTags[i].className==theClass) {
	
		allHTMLTags[i].className="open";
	}
}
}