var pageHasLoaded;
function showLayer(theLayer){
	if(pageHasLoaded){
		if (document.layers){
			eval("document.layers."+theLayer+".visibility = 'show'");
		} else if (document.all){
			eval("document.all."+theLayer+".style.visibility = 'visible'");
		} else{
			eval("document.getElementById('"+theLayer+"').style.visibility = 'visible'");
		}
	}
}

function hideLayer(theLayer){
	if(pageHasLoaded){
		if (document.layers){
			eval("document.layers."+theLayer+".visibility = 'hide'");
		} else if (document.all){
			eval("document.all."+theLayer+".style.visibility = 'hidden'");
		} else{
			eval("document.getElementById('"+theLayer+"').style.visibility = 'hidden'");
		}
	}
}

function moveLayer(theLayer, posX, posY){
	if (document.layers){
		eval("document.layers."+theLayer+".left = posX");
		eval("document.layers."+theLayer+".top = posY");
	} else if (document.all){
		eval("document.all."+theLayer+".style.left = posX");
		eval("document.all."+theLayer+".style.top = posY");
	} else{
		eval("document.getElementById('"+theLayer+"').style.left = posX");
		eval("document.getElementById('"+theLayer+"').style.top = posY");
	}
}

function swapImage(place,src){
	document.images[place].src = src;
}

function swapImageInLayer(place,src,layer){
	if (document.images[place]) {
		document.images[place].src = src;
	}
	else if (document.layers[layer].document.images[place]) {
		document.layers[layer].document.images[place].src = src;
	}
}

function naDa()
	{
	}

function showStatus(sMsg) 
	{
		window.status = sMsg ;
		return true ;
	}
function fPopColorPicker(elem,color) {
		var winColorPicker = window.open('/includes/ColorPicker.aspx?e=' + elem + '&c=' + color, 'ColorPicker', 'width=600,height=500,directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
		winColorPicker.focus();
	}

function naDa()
	{
		
	}
function launchContentMangerHelp() {
	window.open("/HelpContentManager.aspx", '_ContentManagerHelp', 'x=1, y=1, width=780, height=600, scrollbars');
	}

function reloadParent(sURL)
	{
		window.opener.location = sURL;
		window.close();
	}
function addOption(theSel, theText, theValue)
{
  var newOpt = new Option(theText, theValue);
  var selLength = theSel.length;
  theSel.options[selLength] = newOpt;
}

function deleteOption(theSel, theIndex)
{ 
  var selLength = theSel.length;
  if(selLength>0)
  {
    theSel.options[theIndex] = null;
  }
}

function moveOptions(theSelFrom, theSelTo)
{
  
  var selLength = theSelFrom.length;
  var selectedText = new Array();
  var selectedValues = new Array();
  var selectedCount = 0;
  
  var i;
  
  // Find the selected Options in reverse order
  // and delete them from the 'from' Select.
  for(i=selLength-1; i>=0; i--)
  {
    if(theSelFrom.options[i].selected)
    {
      selectedText[selectedCount] = theSelFrom.options[i].text;
      selectedValues[selectedCount] = theSelFrom.options[i].value;
      deleteOption(theSelFrom, i);
      selectedCount++;
    }
  }
  
  // Add the selected text/values in reverse order.
  // This will add the Options to the 'to' Select
  // in the same order as they were in the 'from' Select.
  for(i=selectedCount-1; i>=0; i--)
  {
    addOption(theSelTo, selectedText[i], selectedValues[i]);
  }
	resizeOptions(theSelFrom, theSelTo);
 
}
function resizeOptions(theSelFrom, theSelTo){
		
	if (theSelFrom.options.length == 0){
		theSelFrom.style.visibility = "hidden";
		}
	else {
		theSelFrom.size = theSelFrom.options.length;
		theSelFrom.style.visibility = "visible";
		}
	if (theSelTo.options.length == 0){
		theSelTo.style.visibility = "hidden";
		}
	else {
		theSelTo.size = theSelTo.options.length;
		theSelTo.style.visibility = "visible";
		}
		
	
	}
function selectAllOptions(oSelectList)
	{
		for(i=oSelectList.length-1; i>=0; i--)
		{
			oSelectList.options[i].selected = true;
		}
	}
var theToolTipObj="";

var x
var y
var z = 0
function toolTip(sURL, windowWidth, windowHeight, me) {
    theToolTipObj=me;
    theToolTipObj.onmousemove=updatePos;
    //theToolTipObj.onmouseover=updatePos;
    window.onscroll=updatePos;
    document.getElementById('toolTipBox').innerHTML= "<div id='toolTipDiv' onmouseout='toolTipHide();'><iframe scrolling='no' noresize allowtransparency='true' frameborder='0' height='" + windowHeight + "' width='" + windowWidth + "' class='toolTipFrame' name='myFrame' id='myFrame' src='" + sURL + "'></iframe></div>";
    document.getElementById('toolTipBox').style.display="block";
  
}
function updateParams(ev){
    var myEvent = ev
    if(z==0)
        {
            x=myEvent.clientX-50;
            y=myEvent.clientY-50;            
            z=1;
            //alert(x + ' ' + y);
        }
}

function updatePos() {
    //alert('got here');
    var ev=arguments[0]?arguments[0]:event;
    updateParams(ev);
    diffX=0;
    diffY=0;
    document.getElementById('toolTipBox').style.top  = y-2+diffY+document.body.scrollTop+ "px";
    document.getElementById('toolTipBox').style.left = x-2+diffX+document.body.scrollLeft+"px";
}
function toolTipHide() {
  document.getElementById('toolTipBox').style.display="none";
  z=0;
}
function changeModelImage(myIndex)
    {
    // var PicArray is generated using server-side script
    PicArray[0] = "/images/pixel.gif"
    document.getElementById("ModelImage").src = PicArray[myIndex];
    }
	
