//aoswapper  13 08 2007  Ozbek x/34741
function moveitem(originelement, destinationelement)
{
if(originelement.options.length > 0)
{
    if (originelement.selectedIndex < 0 )
	{
    alert( "Please highlight element(s) from the list");
    
    }
	else
	{
	 var arrorig = new Array();
     var arrdest= new Array();
 
     var i;
	 var j;
	 var k=0;
	 //var selectedin=originelement.selectedIndex
	j=destinationelement.options.length;
 
	 for(i=0; i<destinationelement.options.length; i++)
	 {
	 arrdest[i]=destinationelement.options[i].value + "#" + destinationelement.options[i].text;
	 }

	 for(i=0; i<originelement.options.length; i++)
	 {
		 if(originelement.options[i].selected && originelement.options[i].value !="")
		 {
		 arrdest[j] =originelement.options[i].value + "#" + originelement.options[i].text;
		 //document.write(arrdest[j] + j);
		 //document.write(selectedin);
	     j++;
		 }
		 else
		 {		 
		  arrorig[k]=originelement.options[i].value + "#" + originelement.options[i].text;
		  k++;
		 }
     }
     arrorig.sort();
     arrdest.sort();
     originelement.length = 0;
     destinationelement.length = 0;
	for(c=0; c<arrorig.length; c++) 
	 {
		 //
		 
          var no = new Option();
		  var vals = arrorig[c].split("#");	
		  no.value = vals[0];
          no.text = vals[1];
          originelement[c] = no;
     }
       //    originelement[selectedin]
	//document.write(arrorig.length + 'orig' ); 
 
	for(c=0; c<arrdest.length; c++)
	 {
    	var no2 = new Option();
   	    var vals = arrdest[c].split("#");	
    	 no2.value = vals[0];
         no2.text = vals[1];
         destinationelement[c] = no2;

      }
	// document.write(arrdest.length + 'dest');  
	}
}
}
//select items before submit
function selectelm(selcombo) 
{
     for(var i=0; i<selcombo.length; i++) 
	 {
     selcombo[i].selected = true;
     }
}
//swapper end
//ajax chk modified sep. 2 07-----part copied ww3-------------------
var xmlHttp
//------------------------------
function initbody(str)
{ 
 if (str=='LINK Data')
  {
//alert ("t1");  
 showlists('REGIONAL');
  }
}
//------------------------------
function setelm(elmnam,nu)
{ 
elmnam.options(nu).selected=true;
// alert(nu);
}
//------------------------------
function showmsgpart()
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("This browser does not support AJAX!");
  return;
  } 
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET","msgpart.htm",true);
xmlHttp.send(null);
//alert ("z2");
}

//------------------------------
function showlists(str)
{ 
hiddenvisible('loadmsg','visible');
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("This browser does not support AJAX!");
  return;
  } 
var url="aoselectform.asp";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
//alert (" hhhh"); 
xmlHttp.open("GET",url,true);
//
xmlHttp.send(null);
//
}

//------------------------------
function stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	document.getElementById("formarea").innerHTML=xmlHttp.responseText;
//	alert (" hhhh"); 
	hiddenvisible('loadmsg','hidden');
	}
}

//------------------------------
function GetXmlHttpObject()
{
var xmlHttp=null;
/*
if (window.XMLHttpRequest) 
{
xmlHttp=new XMLHttpRequest();
}
else
{
	if (window.ActiveXObject)
	{
	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP.3.0");	
	}
}
*/	

try
	  {
	  // Firefox, Opera, Safari
	  xmlHttp=new XMLHttpRequest();
	  
	  }
catch (e)
	  {
	  // Internet Explorer
		  try
			{
							
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			
			}
			catch (e)
			{
				
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			
			}
  	   }
return xmlHttp;
}
//-------------------------------end ajax chk

function checkform ( form )
{
  if (form.selectedregionlist.length == 0 || form.selectedregitemlist.length == 0)
  {
    alert( "Please complete your selections." );
    return false ;
  }
  return true ;
}


function showhelp(helpHTM)
{ 
  //hdif=90;
  //h=screen.availHeight-hdif; 
  yref=window.open(helpHTM,"zz","height=500,,left=1,width=400,top=1,scrollbars=no,resizable=no,status=no,menubar=no,toolbar=no,location=no");
  yref.focus()
}
//showhide divs
function hiddenvisible(layersid,stat)
{
if (document.all)
	{ 
	eval( "document.all." + layersid + ".style.visibility = stat");
	}
if (document.layers)
	{ 
	//NETSCAPE 
	document.layers[layersid].visibility = stat;
	}
if (document.getElementById && !document.all)
	{
	alllayerid = document.getElementById(layersid);
	alllayerid.style.visibility = stat;
	}
 return;
}
