<!--

  
function InputText(Question,Target,Default) 
  { 
  answer = prompt(Question,Default)
  if (answer != null) 
    {   
    window.location = Target + escape(answer)
    } 
  }
	
	
	
function ConfirmChoice(Question,Target) 
  { 
  answer = confirm(Question)
  if (answer !=0) 
    {   
    window.location = Target
    } 
  }
  
function HideDiv(DivName)
  {
  document.getElementById(DivName).style.display = 'none';
  }

function ShowDiv(DivName)
  {
  document.getElementById(DivName).style.display = 'inline';
  }
  
  
  
  // script for multiple select from list

var arrOldValues;

function SelectAllList(CONTROL){
for(var i = 0;i < CONTROL.length;i++){
CONTROL.options[i].selected = true;
}
}

function DeselectAllList(CONTROL){
for(var i = 0;i < CONTROL.length;i++){
CONTROL.options[i].selected = false;
}
}


function FillListValues(CONTROL){
var arrNewValues;
var intNewPos;
var strTemp2;
strTemp2 = '';
var strTemp = GetSelectValues(CONTROL);
arrNewValues = strTemp.split("|");
for(var i=0;i<arrNewValues.length-1;i++){
if(arrNewValues[i]==1){
intNewPos = i;
}
//strTemp2 += CONTROL.options[i].value + '|'
}

for(var i=0;i<arrOldValues.length-1;i++){
if(arrOldValues[i]==1 && i != intNewPos){
CONTROL.options[i].selected= true;
}
else if(arrOldValues[i]==0 && i != intNewPos){
CONTROL.options[i].selected= false;
}

if(arrOldValues[intNewPos]== 1){
CONTROL.options[intNewPos].selected = false;
}
else{
CONTROL.options[intNewPos].selected = true;
}
}
for(var i = 0;i < CONTROL.length;i++){
if(CONTROL.options[i].selected == true){
strTemp2 += CONTROL.options[i].value + '|'
}
}
//document.getElementByID(optionstosel).value='asdf';
alert(strTmp2);
}


function GetSelectValues(CONTROL){
var strTemp = "";
for(var i = 0;i < CONTROL.length;i++){
if(CONTROL.options[i].selected == true){
strTemp += "1|";
}
else{
strTemp += "0|";
}
}
return strTemp;
}

function GetCurrentListValues(CONTROL){
var strValues = "";
strValues = GetSelectValues(CONTROL);
arrOldValues = strValues.split("|")
}

function Removeitem(itemid2, mainitemid) {
    // native XMLHttpRequest object
    document.getElementById(mainitemid).innerHTML = 'Removing ...';
    document.getElementById(mainitemid).style.color = '#000080';
    var fullurl = 'remove_attached_item.asp?itemid=' + itemid2 + '&mainitemid=' + mainitemid
	//alert(fullurl);
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = function() {removedone(mainitemid);};
        req.open("GET",fullurl, true);
        req.send(null);
    // IE/Windows ActiveX version
      }
    else if (window.ActiveXObject)
      {
      req = new ActiveXObject("Microsoft.XMLHTTP");
      if (req)
        {
        req.onreadystatechange = function() {removedone(mainitemid);};
        req.open("GET",fullurl, true);
        req.send();
        }
    }
}

function removedone(itemid1) {
  // only if req is "loaded"
  if (req.readyState == 4) {
    // only if "OK"
    if (req.status == 200) {
      results = req.responseText;
      if (results!='OK')
        {
        document.getElementById(itemid1).innerHTML = 'Error!';
        document.getElementById(itemid1).style.color = '#FF0000';
		alert(results);
        }
      else
        {
        document.getElementById(itemid1).innerHTML = 'Removed';
        }
      }
    else
      {
      //document.getElementById(targetFrame).innerHTML="checkEmployerLogin error:\n" +
      alert(req.responseText);
  //    alert('Error!');
      }
    }
  }

	function showChangeCat(Linktoshow){
			OpenWin = this.open(Linktoshow, "newWindow", "toolbar=no, menubar=no ,location=no, scrollbars=yes, resizable=no, width=400, height=150");
			var winW = 700, winH = 600;

			if (parseInt(navigator.appVersion)>3) {
			 if (navigator.appName=="Netscape") {
				winW = window.innerWidth;
				winH = window.innerHeight;
			 }
			 if (navigator.appName.indexOf("Microsoft")!=-1) {
				winW = document.body.offsetWidth;
				winH = document.body.offsetHeight;
			 }
			}
			
			OpenWin.moveTo((winW - 700) / 2,(winH - 600)/2);
		}
	function reduceQuantity(boxName)
  {
  	var qty,newqty,input 
		input = document.getElementById(boxName);
		qty = input.value;
		if (isInteger(qty) && parseInt(qty) > 1)
		{
			input.value = parseInt(qty)-1;
		}
		else
		{
			input.value = 1;
		}
		input.focus();
  }
	function addQuantity(boxName)
  {
  	var qty,newqty,input 
		input = document.getElementById(boxName);
		qty = input.value;
		if (isInteger(qty))
		{
			input.value = parseInt(qty)+1;
		}
		else
		{
			input.value = 1;
		}
		input.focus();
  }
	function isInteger (s)
 	{
		var i;

		if (isEmpty(s))
		if (isInteger.arguments.length == 1) return 0;
		else return (isInteger.arguments[1] == true);

		for (i = 0; i < s.length; i++)
		{
			 var c = s.charAt(i);

			 if (!isDigit(c)) return false;
		}

		return true;
 	}
   function isEmpty(s)
   {
      return ((s == null) || (s.length == 0))
   }
   function isDigit (c)
   {
      return ((c >= "0") && (c <= "9"))
   }
//-->



