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;
		}
	}
	