function Menu(value,count)
{
	
	for(i=1 ; i<=count ; i++)
	if(document.getElementById(value+i).style.display == "none")
		document.getElementById(value+i).style.display = "block";
	else
	document.getElementById(value+i).style.display = "none";
	
}

function show() 
{

	if (document.all) 
	{
		document.images.pic.style.filter='revealTrans(duration=0)';
		document.images.pic.style.filter='revealTrans(transition = kind)';
		document.images.pic.filters.revealTrans.apply();
	}

	document.images.pic.src = preLoad[run].src;

	if (document.all) 
	{
		document.images.pic.filters.revealTrans.Play();
	}

	run++;
	if (run > (a - 1)) 
		run = 0;

	kind++;
	if (kind > 22 ) 
		kind = 0;
	
	setTimeout('show()', Speed);
}

function show1() 
{

	if (document.all) 
	{
		document.images.pic1.style.filter='revealTrans(duration=0)';
		document.images.pic1.style.filter='revealTrans(transition = kind)';
		document.images.pic1.filters.revealTrans.apply();
	}

	document.images.pic1.src = preLoad1[run1].src;

	if (document.all) 
	{
		document.images.pic1.filters.revealTrans.Play();
	}

	run1++;
	if (run1 > (a1 - 1)) 
		run1 = 0;

	kind1++;
	if (kind1 > 22 ) 
		kind1 = 0;
	
	setTimeout('show1()', Speed1);
}
function show2() 
{

	if (document.all) 
	{
		document.images.pic2.style.filter='revealTrans(duration=0)';
		document.images.pic2.style.filter='revealTrans(transition = kind)';
		document.images.pic2.filters.revealTrans.apply();
	}

	document.images.pic2.src = preLoad2[run2].src;

	if (document.all) 
	{
		document.images.pic2.filters.revealTrans.Play();
	}

	run2++;
	if (run2 > (a2 - 1)) 
		run2 = 0;

	kind2++;
	if (kind2 > 22 ) 
		kind2 = 0;
	
	setTimeout('show2()', Speed2);
}
function show3() 
{

	if (document.all) 
	{
		document.images.pic3.style.filter='revealTrans(duration=0)';
		document.images.pic3.style.filter='revealTrans(transition = kind)';
		document.images.pic3.filters.revealTrans.apply();
	}

	document.images.pic3.src = preLoad3[run3].src;

	if (document.all) 
	{
		document.images.pic3.filters.revealTrans.Play();
	}

	run3++;
	if (run3 > (a3 - 1)) 
		run3 = 0;

	kind3++;
	if (kind3 > 22 ) 
		kind3 = 0;
	
	setTimeout('show3()', Speed3);
}

function show4() 
{

	if (document.all) 
	{
		document.images.pic.style.filter='revealTrans(duration=0)';
		document.images.pic.style.filter='revealTrans(transition = kind)';
		document.images.pic.filters.revealTrans.apply();
	}

	document.images.pic.src = preLoad[run].src;

	if (document.all) 
	{
		document.images.pic.filters.revealTrans.Play();
	}

	run++;
	if (run > (a - 1)) 
		run = 0;

	kind++;
	if (kind > 22 ) 
		kind = 0;
	document.links[pos-1].href=link[run];

	setTimeout('show4()', Speed);
}

function CheckAll() {
	for (var i=0;i<document.form.elements.length;i++) {
    	var e = document.form.elements[i];
        if ((e.name != 'allbox') && (e.type=='checkbox')) {
          e.checked = document.form.allbox.checked;
        }
    }
}

function ajaxLoader(url,id) {
  if (document.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }
  if (x) {
    x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
        el = document.getElementById(id);
        el.innerHTML = x.responseText;
      }
    }
    x.open("GET", url, true);
    x.send(null);
  }
}
var checkflag = "false";
function check(field) {
	if (checkflag == "false") {
		for (i = 0; i < field.length; i++) {
			field[i].checked = true;
		}
		checkflag = "true";
		return "Uncheck All"; 
	}
	else {
			for (i = 0; i < field.length; i++) {
				field[i].checked = false; 
			}
			checkflag = "false";
			return "Check All"; 
		}
}
/*function ajaxLoader(url,id) {
  //if (document.getElementById) {
    //var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
	var x = false
	if (window.XMLHttpRequest) // if Mozilla, Safari etc
		x = new XMLHttpRequest()
	else if (window.ActiveXObject){ // if IE
		try {
				x = new ActiveXObject("Msxml2.XMLHTTP")
			} 
		catch (e){
					try{
							x = new ActiveXObject("Microsoft.XMLHTTP")
						}
					catch (e){}
		}
	}else
		return false;
//}
  if (x) {
    x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
        el = document.getElementById(id);
        el.innerHTML = x.responseText;
      }
    }
    x.open("GET", url, true);
    x.send(null);
  }
}*/
function LoadFrom2ComboBoxWithOneValue(obj1,obj2,obj3,obj4,obj5,obj6,start,status)
{
	var num= obj3.length;
	var arrItem=new Array();
	count=0;
	if (obj2.length>1)
	for (i=eval(start);i<obj2.length;i++)
		arrItem[count++]=obj2.options[i].value;
	var countItem=obj2.length;
	for (j=1;j<countItem;j++)
		{
			for (i=0;i<arrItem.length;i++)
				{
					if (obj2.options[j].value==arrItem[i])
						obj2.options[j]= null;
				}
			countItem=obj2.length;
		}
	if (obj1.value!=0)
	{
		for (i=0;i<num;i++){
			if (obj3[i].value==obj1.value)
				{
					newoption = new Option(obj4[i].value,obj5[i].value, false,false);
					obj2.options[obj2.length] = newoption;
				}
		}
	}
	
	if (eval(status)==1)
		for (i=0;i<obj2.length;i++)
		{
			if (obj2.options[i].value==obj6.value)
				obj2.options[i].selected=true;
		}
}

function doAdd(obj1,obj2)
{
	for (i=0;i<obj1.length;i++){
		if (obj1.options[i].selected){
			var selectedText = obj1.options[i].text;
			var selectedValue = obj1.options[i].value;
			var ite=true;
			for (j=0;j<obj2.length;j++)
			{
				thisItem=obj2.options[j].value;
				if (thisItem==selectedValue)
					{
						ite=false;
						break;
					}
			}
			if (ite==true)
			{
				newoption = new Option(selectedText, selectedValue, false,false);
				obj2.options[obj2.length] = newoption;
				//document.frmAddjob.location1.options[selectedItem] = null;
				//jobFee(document.frmAddjob.location2);
			}
		}
	}
}


function removeItem(obj)
{
	var arrItem=new Array();
	var count=0;
	var num=0;
	var boxlength=obj.length;
	for (i=0;i<boxlength;i++)
		{
			//var selectedItem = document.frmAddjob.location2.selectedIndex;
			if (obj.options[i].selected)
				arrItem[count++]=obj.options[i].value;
		}
	for (j=0;j<boxlength;j++)
		{
			for (k=0;k<arrItem.length;k++)
				if (obj.options[j].value==arrItem[k])
					{
						obj.options[j]=null;
					}
				boxlength=obj.length;
		}
}

// obj1 is a value list
//obj2 is a hidden keep value of list
function getvalue(obj1,obj2)
{
	var strValues = "";
	var boxLength = obj1.length;
	var count = 0;
	if (boxLength != 0) {
		for (i = 0; i < boxLength; i++) {
			if (count == 0) {
				strValues = obj1.options[i].value;
			}
			else {
					strValues = strValues + "," + obj1.options[i].value;
			}
			count++;
	   }
	}
	obj2.value=strValues;
}

function getValueListCheckBox(list,id)
{
	var num=list.length;
	if (num==undefined)
		id.value=list.value;
	else
		{
			count=0;
			str="";
			for (i=0;i<num;i++)
			{
				if (list[i].checked)
					{
						if (count==0)
							str=list[i].value;
						else
							str = str + "," + list[i].value;
						count++;
					}
			}
						id.value=str;
		}
}
function getValueListLocation(list,id,status)
{
	var num=list.length;
	if (num==undefined)
		id.value=list.value;
	else
		{
			count=0;
			str="";
			for (i=0;i<num;i++)
			{
				if (list[i].checked)
					{
						if (count==0)
							str=list[i].value;
						else
							str = str + "," + list[i].value;
						count++;
					}
			}
						id.value=str;
		}
	if (id.value=="")	
		alert("Please select logo!");			
	else
		if (eval(status)>0)
			window.location="?act=ht_adm_logo_banner&stvl="+status+"&logo_id="+id.value;
}

function getsort(ck,tx,sortvl,id,status)
{
	var num=ck.length;
	if (num==undefined)
		sortvl.value=tx.value;
	else
		{
			count=0;
			str="";
			for (i=0;i<num;i++)
			{
				if (ck[i].checked && eval(tx[i].value)>=0)
					{
						if (count==0 )
							str=tx[i].value;
						else
							str = str + "," + tx[i].value;
						count++;
					}
			}
						sortvl.value=str;
		}
	if (sortvl.value=="")	
		alert("Please select logo!");			
	else
		window.location="?act=ht_adm_logo_banner&stvl="+status+"&logo_id="+id.value+"&sort="+sortvl.value;
}

function checkMail(object)
{
	var x = object;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) return true;
	else return false;
}

function getLengthtextarear(item1,item2,num)
	{
		var str=item2.value;
		item1.value=item2.value.length;
		if (item2.value.length>eval(num))
		{
			alert("Max Letters are "+num);
			item2.value=str.substring(0,eval(num));
			item1.value=item2.value.length;
		}
	}

function checkphone(obj)
{
	if (obj!="")
	{											
		var str=obj;
		var valid="0123456789 -.()+EeXxTtNnSsIiOo:<br>/";
		var ok="yes";
		var temp;
		for (var i=0;i<str.length;i++){
			temp = "" +str.substring(i, i+1);
			if (valid.indexOf(temp) == -1) ok = "no";
		}
		if (ok == "no") {
			return false;
		}
	}
	return true;
}
