
//3

function checknum(field)
{
var checkOK2 = "1234567890";
  var checkStr1 = field.value;
  var allValid1 = true;
  
  for (i = 0;  i < checkStr1.length;  i++)
  {
    ch = checkStr1.charAt(i);
    for (j = 0;  j < checkOK2.length;  j++)
      if (ch == checkOK2.charAt(j))
        break;
    if (j == checkOK2.length)
    {
      allValid1 = false;
      break;
    }
  }
  
    if (!allValid1)
  {
    alert("You must enter Number!!!");
	field.focus();
	field.select();
    return (false);
  }
  
}

function checkalpha(field){
	var checkOK1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@. ";
	var checkStr1 = field.value;
	var allValid1 = true;
	
	for (i = 0;  i < checkStr1.length;  i++){
		ch = checkStr1.charAt(i);
		for (j = 0;  j < checkOK1.length;  j++)
			if (ch == checkOK1.charAt(j))
				break;
				if (j == checkOK1.length)
				{
					allValid1 = false;
					break;
				}
				else { field.value=field.value.toUpperCase(); break;}
			}
			
			if (!allValid1){
				alert("Please insert only alphabets in this field!");
				field.focus();
				field.select();
				return (false);
			}
}

function checknumeric(field){
	pattern = /^[0-9]*$/;
	if(pattern.test(field.value)==false){
		alert("Please fill this field with numeric values only!");
		field.focus();
		field.select();
		return false
	}
	return true;
}

function closewindow() 
{ 
window.close();
} 



function newwindow1() 
{ 
window.open('http://www.undplao.org/projectdb/reports/map.asp?agency=1&criteria_1=Project&criteria_2=Sector&Title=Agency:+UNDP+-+United+Nations+Development+Programme','','toolbar=no, directories=no, location=no,status=yes, menubar=no, resizable=yes, scrollbars=yes'); 
} 


function newwindow2() 
{ 
window.open('http://www.undplao.org/about/uxopoorestmap.php','','toolbar=no, directories=no, location=no,status=yes, menubar=no, resizable=no, scrollbars=no, width=687,height=425'); 
} 


function newwindow3() 
{ 
window.open('http://www.undplao.org/projectdb/reports/table.asp?agency=1&Title=Agency:+UNDP+-+United+Nations+Development+Programme','','toolbar=no, directories=no, location=no,status=yes, menubar=no, resizable=yes, scrollbars=yes'); 
} 

function closewindow() 
{ 
window.close();
} 

function Show()
	{
		x = event.clientX + document.body.scrollLeft; // get the mouse left position
		y = event.clientY + document.body.scrollTop + 15; // get the mouse top position 
		Popup.style.display="block"; // display the pop-up
		Popup.style.left = x; // set the pop-up's left
		Popup.style.top = y; // set the pop-up's top
	}
	// this function hides the pop-up when user moves the mouse out of the link
	function Hide()
	{
		Popup.style.display="none"; // hide the pop-up
	}
///////
//for extras toggle page 

var wm_openPopup=null;

function wm_hidePopup() {
if (wm_openPopup!=null) {wm_openPopup.style.display="none";wm_openPopup=null;}
document.onclick=null;
}

function wm_toggleDiv(objname) {var obj=document.all(objname); if (obj.style.display=="none") obj.style.display="block"; else obj.style.display="none";}

function wm_showPopup(objname,noevent) {
var obj=document.all(objname);
if (obj==null) return;
if (wm_openPopup!=null) {
	if (wm_openPopup==obj) {wm_hidePopup();return;}
	wm_hidePopup();
	}
wm_openPopup=obj; obj.style.display="block"; 
if (noevent!=1) event.cancelBubble=true; 
document.onclick=wm_hidePopup;
}

function wm_handleAddrAdded(id) {document.all("gAddAddr"+id).innerHTML="Contact created successfully";}
function wm_createTarget(name) {document.all("GHIDDEN").innerHTML="<iframe name='"+name+"'></iframe>";}
function wm_loadScript(url) {document.all("JSHIDDEN").src=url;}


//myomin change bg image


var theImages = new Array() 

// to increment the theImages[x] index!

theImages[0] = 'banner01.jpg'
theImages[1] = 'banner02.JPG'
theImages[2] = 'banner03.JPG'
theImages[3] = 'banner04.jpg'
theImages[4] = 'banner05.JPG'

// ======================================
// do not change anything below this line
// ======================================

var j = 0
var p = theImages.length;

var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}

var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write(theImages[whichImage]);
}

//-->


// send email


function mailpage()
{
  mail_str = "mailto:?subject= UNDP Lao " + document.title;
  mail_str += "&body= " + document.title;
  mail_str += ". You should check this out at, " + location.href; 
  location.href = mail_str;
}

//email

function printFunction(Obj){
	
		
		for(i=0;i<document.images.length;i++){
			if(document.images[i].id=="printIco" || document.images[i].id=="closeIco") 				    		  		
				document.images[i].style.display="none";
		}
			
	
		window.print(document); //PRINT THE DOCUMENT


		for(i=0;i<document.images.length;i++){
			if(document.images[i].id=="printIco" || document.images[i].id=="closeIco") 							     
				document.images[i].style.display="";
			
		}
		
	}//end of function printFunction()

