
//------------------------------------------------------------------------------------------------------
var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee



function confirmAdd() {
    if(document.PostForm.aname.value=="")
        {
            alert('Please enter your name!');
            document.PostForm.aname.focus();
            return false;

        } 
        
    if(document.PostForm.address.value=="")
        {
            alert('Please enter your address!');
            document.PostForm.address.focus();
            return false;

        }
    
    if(document.PostForm.city.value=="")
        {
            alert('Please enter your city!');
            document.PostForm.city.focus();
            return false;

        } 
        
    if(document.PostForm.postal.value=="")
        {
            alert('Please enter your postal!');
            document.PostForm.postal.focus();
            return false;

        }       
        
    if(document.PostForm.state.value=="")
        {
            alert('Please enter your state!');
            document.PostForm.state.focus();
            return false;

        } 
        
    if(document.PostForm.phone.value=="")
        {
            alert('Please enter your phone!');
            document.PostForm.phone.focus();
            return false;

        }       
        
    if(document.PostForm.email.value=="")
        {
            alert('Please enter your email!');
            document.PostForm.email.focus();
            return false;

        } 
        
    if(document.PostForm.ceo.value=="")
        {
            alert('Please enter name of CEO!');
            document.PostForm.ceo.focus();
            return false;

        }       
        
    if(document.PostForm.ic.value=="")
        {
            alert('Please enter your Identity Card No!');
            document.PostForm.ic.focus();
            return false;

        } 
        
    if(document.PostForm.contact_person.value=="")
        {
            alert('Please enter the contact person!');
            document.PostForm.contact_person.focus();
            return false;

        }       
}


function confirmDelete(){
	if (confirm("Are You sure You Wish To Continue?"))
		return true;
	else
		return false;
}

// to do the shift list box thingy
var selectedList;
var availableList;
function createListObjects(){
    availableList = document.getElementById("availableOptions");
    selectedList = document.getElementById("selectedOptions");
}

function delAttribute(){
   var selIndex = selectedList.selectedIndex;
   if(selIndex < 0)
      return;
   availableList.appendChild(
      selectedList.options.item(selIndex))
   selectNone(selectedList,availableList);
   setSize(availableList,selectedList);
}
function addAttribute(){
   var addIndex = availableList.selectedIndex;
   if(addIndex < 0)
      return;
   selectedList.appendChild(
      availableList.options.item(addIndex));
   selectNone(selectedList,availableList);
   setSize(selectedList,availableList);
}

function setTop(top){
	document.getElementById
      ('someLayer').style.top = top;
}
function setLayerTop(lyr,top){
	lyr.style.top = top;
}

//set size
/*function setSize(list1,list2){
    list1.size = getSize(list1);
    list2.size = getSize(list2);
}
*/
function selectNone(list1,list2){
    list1.selectedIndex = -1;
    list2.selectedIndex = -1;
    addIndex = -1;
    selIndex = -1;
}

function getSize(list){
    /* Mozilla ignores whitespace,
       IE doesn't - count the elements
       in the list */
    var len = list.childNodes.length;
    var nsLen = 0;
    //nodeType returns 1 for elements
    for(i=0; i<len; i++){
        if(list.childNodes.item(i).nodeType==1)
            nsLen++;
    }
    if(nsLen<2)
        return 2;
    else
        return nsLen;
}


function delAll(){
    var len = selectedList.length -1;
    for(i=len; i>=0; i--){
        availableList.appendChild(selectedList.item(i));
    }
    selectNone(selectedList,availableList);
    setSize(selectedList,availableList);

}

function addAll(){
    var len = availableList.length -1;
    for(i=len; i>=0; i--){
        selectedList.appendChild(availableList.item(i));
    }
    selectNone(selectedList,availableList);
    setSize(selectedList,availableList);

}

function showSelected(){
    var optionList =document.getElementById("selectedOptions").options;
    var data = '';
    var len = optionList.length;
		var arr = new Array();

    for(i=0; i<len;i++){
        //data += optionList.item(i).value;
			arr.push(optionList.item(i).value);
    }
		//var str = arr.join(",");
		//alert(str);
    document.forms[0].roles.value = arr;

}




