
function test(){alert('dddd');}

function showmap(name,lang)
{
	
	/*
	var path='';
	if(lang=='EN'){path='../';}

	 var myWin=null;
	 var width=800;
	 var height=400;
	 var  leftVal = Math.abs((width - screen.width) / 2);
	 var topVal =  Math.abs((height - screen.height) / 2);
	 
	 var winopt='menubar=0,scrollbars=1,resizable=1,width='+width+',height='+height+',left='+leftVal+',top='+topVal;
					myWin=window.open("map.html","myWin",winopt);
					myWin.document.write("<div style='width:100%;' align='center'><img src='"+path+'offices/'+name+"' border='0'/></div>");
					myWin.focus();
					*/	
	}
function showmap2(name,lang,tdid){
	
	var detail="";
	var td=document.getElementById(tdid);
	var td0=document.getElementById(tdid+"_1");
	if(td0!="")detail=td0.innerHTML;
	showmapui2(td.innerHTML,lang,name,detail);
}

function showmapui2(conternt,lang,img,detail)
{
	var path='';
	if(lang=='EN'){path='../';}
	 var myWin=null;
	 var width=800;
	 var height=550;
	 var  leftVal = Math.abs((width - screen.width) / 2);
	 var topVal =  Math.abs((height - screen.height) / 2);
	 var dvInfo ="";
	var style="";
	style=".input{border-right: gainsboro 1px solid;";
	style+="border-top: gainsboro 1px solid;";
	style+="border-left: gainsboro 1px solid;";
	style+="border-bottom: gainsboro 1px solid;";
	style+="font-size:10pt;";
	style+="font-family:Tahoma;}";
	style+=".text_blue{font-family:Arial, Helvetica, Utkal, sans-serif;";
	style+="font-size:11px;font-weight: normal;";
	style+="color: #1a3b8d;}";
    var scr="script"
	 //dvInfo ="<style  rel='stylesheet' type='text/css' >"+style+"</stype>";
    
    var Name=GETNAME();	
    var Name=Name+"("+detail+")";
	dvInfo +=" <html xmlns='http://www.w3.org/1999/xhtml'>\n<head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\n</header>";	
	dvInfo +="<body  style='background-color: white;'>"
	 dvInfo +="	<div align='center' style='width:100%'>\n";
	 dvInfo +="<table style='z-index:5000;background-color:white;'>";
	 dvInfo +="<tr><td align='center'>";
	 dvInfo +="<table style='z-index:5000;background-color: white;'>";
	 dvInfo +="<tr><td class='text_blue' align='left' style='font-family:Arial, Helvetica, Utkal, sans-serif;font-size:14px;font-weight: bold;color: #1a3b8d;'   valign='top'>"+Name+"</td></tr>";
	 dvInfo +="<tr><td style='font-family:Arial, Helvetica, Utkal, sans-serif;font-size:11px;font-weight: normal;color: #1a3b8d;' valign='top'>"+conternt+"</td></tr>";
	/*
	 dvInfo +="<tr><td class='text_blue' align='left' style='font-family:Arial, Helvetica, Utkal, sans-serif;font-size:11px;font-weight: normal;color: #1a3b8d;'   valign='top'>"+Province+"</td></tr>";
	 dvInfo +="<tr><td class='text_blue' align='left' style='font-family:Arial, Helvetica, Utkal, sans-serif;font-size:11px;font-weight: normal;color: #1a3b8d;'   valign='top'>Tel:"+Tel+"</td></tr>";
	 dvInfo +="<tr><td class='text_blue' align='left' style='font-family:Arial, Helvetica, Utkal, sans-serif;font-size:11px;font-weight: normal;color: #1a3b8d;'   valign='top'>Fax:"+Fax+"</td></tr>";
	 dvInfo +="<tr><td class='text_blue' align='right' style='font-family:Arial, Helvetica, Utkal, sans-serif;font-size:11px;font-weight: normal;color: #1a3b8d;'   valign='top'></td></tr>";
	 dvInfo +="<tr><td  align='left' class='text_blue' colspan='2'  valign='top'></td></tr>";
	 */
	 //dvInfo +="</td></tr>" +
	 dvInfo +="</table>";
	 dvInfo +="<tr><td align='right' class='text_blue' valign='top'>";
	 dvInfo +="<input id='uxbtnprint' onclick='javascript:printme();' type='button' value='Print' class='input' style='cursor:pointer;border: gainsboro 1px solid;font-family:Tahoma;font-size:10pt;' />";
	 dvInfo +="</td></tr>";
	 dvInfo +="<tr><td align='left' class='text_blue' valign='top'>";
	 dvInfo +="<img src='"+path+'offices/'+img+"' border='0'/>";
	 dvInfo +="</td></tr>";
	 dvInfo +="</table>";
	 dvInfo +="</div></body>";
	 dvInfo +="</html>\n";
	 dvInfo +="<"+scr+"  language='javascript'>";
	 dvInfo +="window.onbeforeprint=printmap;";
	 dvInfo +="window.onafterprint=printmapdone;";
	 dvInfo +="function printme(){window.print();};";
	 dvInfo +="function printmap(){var btn = document.getElementById('uxbtnprint');btn.style.display='none';/*alert('Please click to next print this page.')*/}";
	 dvInfo +="function printmapdone(){var btn = document.getElementById('uxbtnprint');btn.style.display='';}";
	 dvInfo +="function delayPrint(){alert('Print Doc')}";
	 dvInfo +="</"+scr+">";
	/* dvInfo+="<body><div style='width:100%;' align='center'>";
	 dvInfo+="<table style=' z-index:5000;background-color: white;'>";
	 dvInfo+="<tr><td>xxxx</td></tr>"
	 dvInfo+="</table>";
	 dvInfo+="	 </div></body>";*/
	 

	 				var winopt="fullscreen=1";//'menubar=0,scrollbars=1,resizable=1,width='+width+',height='+height+',left='+leftVal+',top='+topVal;
					myWin=window.open("map.html","myWin",winopt);					
					myWin.document.write(dvInfo);
					myWin.location.reload();
					myWin.focus();	
					myWin.print();
}

function trim(val){
	return val.replace(/\,/g,'');
	
}
function decode(String){ 
	return String.replace(/\</g,'&lt;').replace(/\>/g,'&gt;') ; 
	}
function getdistrict2(obj,item,refobj)
{

	var uxDDLDistric=document.getElementById(refobj);
	if(obj.selectedIndex==item)
		{
		uxDDLDistric.options[0].selected=true;
		uxDDLDistric.disabled=false;
		}
	else
		{
			uxDDLDistric.options[uxDDLDistric.selectedIndex].selected=false;
			uxDDLDistric.options[0].selected=true;
			uxDDLDistric.disabled=true;
		}
	}
function showimage(obj)
 {
	 var myWin=null;
	 var width=800;
	 var height=400;
	 var  leftVal = Math.abs((width - screen.width) / 2);
	 var topVal =  Math.abs((height - screen.height) / 2);
	 var winopt='menubar=0,scrollbars=1,resizable=1,width='+width+',height='+height+',left='+leftVal+',top='+topVal;
	 if(myWin==null)
		{
					myWin=window.open("","myWin",winopt);
		}
		
			myWin.document.write("");

			myWin.document.write("<img src='"+obj.src+"' border=0 />"); 
			myWin.focus();
	}

function closebox(objName)
{
	var addBox = document.getElementById(objName);
	addBox.style.display='none';
	}


function wait(){var imgwait=document.getElementById('imgwait');imgwait.style.display='';}
function done(){var imgwait=document.getElementById('imgwait');imgwait.style.display='none';}
function findval(ddl,val,IgnorCase)
{
	var found = false;
	 for(var i=0;i<ddl.options.length&&(!found);i++)
		 {
		 if(ddl.options[i].value.toUpperCase()==val.toUpperCase())
			 {
				 if(IgnorCase)
				 {
					 
					 found=true;
					 ddl.options[i].selected=true;
					 
				 }
				 else
					 {
					 if(ddl.options[i].value==val)
						 {
							 found=true;
							 ddl.options[i].selected=true;
						 }
					 }
			 }
		 
		 }
}
function findtxt(ddl,val,IgnorCase)
{
	var found = false;
	 for(var i=0;i<ddl.options.length&&(!found);i++)
		 {
		 if(ddl.options[i].text.toUpperCase()==val.toUpperCase())
			 {
				 if(IgnorCase)
				 {
					 found=true;
					 ddl.options[i].selected=true;
					 
				 }
				 else
					 {
					 if(ddl.options[i].text==val)
						 {
							 found=true;
							 ddl.options[i].selected=true;
						 }
					 }
			 }
		 
		 }
}

function showboxWh(objParentID,boxName,W,H)
{
    var objbox = document.getElementById(boxName);
    var obj = document.getElementById(objParentID);
   
    var p=findPos(obj);
   
     if(p.length>=2)
    {
  
        var left=p[0];
        var top = p[1];
      
        if((left!=0 )&&(top!=0))
        {
        	
            objbox.style.display="";
            left=left-W;
            top=top-H;
           objbox.style.left=left+"px";
           objbox.style.top=top+"px";
            
        }
    }
}
function findPos(obj) 
{
    var curleft = curtop = 0;
    if (obj.offsetParent) 
    {
        do {
        curleft += obj.offsetLeft;
        curtop += obj.offsetTop;
        } while (obj = obj.offsetParent);
    }
return [curleft,curtop];
}

function isGUID(objGuid)
{ 

var str =(objGuid);
var reEmail = /^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$/
var bresults

if(objGuid==""){

bresults=false;

}
else{
if(reEmail.test(str))
{
bresults = true ; }
else
{
bresults = false;
} } 
return bresults;
}

function isEmail(id) 
{ 

var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/; 
return !emailPattern.test(id); 

}

function moverow(obj)
{
 obj.style.backgroundColor="#ffffc9";
}
function moveout(obj)
{
 obj.style.backgroundColor="";
}

/*List Select*/
function compareOptionValues(a, b) 
{ 
  var sA = parseInt( a.value, 36 );  

  var sB = parseInt( b.value, 36 );  

  return sA - sB;
}


function compareOptionText(a, b) 

{ 

  // Radix 10: for numeric values

  // Radix 36: for alphanumeric values

  var sA = parseInt( a.text, 36 );  

  var sB = parseInt( b.text, 36 );  

  return sA - sB;

}



// Dual list move function

function moveDualList(srcList,destList,moveAll ) 

{
		

  if (  ( srcList.selectedIndex == -1 ) && ( moveAll == false )   )
  {

    return;

  }



  newDestList = new Array( destList.options.length );



  var len = 0;



  for( len = 0; len < destList.options.length; len++ ) 

  {

    if ( destList.options[ len ] != null )

    {

      newDestList[ len ] = new Option( destList.options[ len ].text, destList.options[ len ].value, destList.options[ len ].defaultSelected, destList.options[ len ].selected );

    }

  }



  for( var i = 0; i < srcList.options.length; i++ ) 

  { 

    if ( srcList.options[i] != null && ( srcList.options[i].selected == true || moveAll ) )

    {


       newDestList[ len ] = new Option( srcList.options[i].text, srcList.options[i].value, srcList.options[i].defaultSelected, srcList.options[i].selected );

       len++;

    }

  }
  // Sort out the new destination list
  newDestList.sort( compareOptionValues );   // BY VALUES
  //newDestList.sort( compareOptionText );   // BY TEXT
  // Populate the destination with the items from the new array
  for ( var j = 0; j < newDestList.length; j++ ) 
  {

    if ( newDestList[ j ] != null )

    {

      destList.options[ j ] = newDestList[ j ];

    }

  }
  // Erase source list selected elements
  for( var i = srcList.options.length - 1; i >= 0; i-- ) 

  { 

    if ( srcList.options[i] != null && ( srcList.options[i].selected == true || moveAll ) )

    {
       srcList.options[i]       = null;
    }

  }

} 

/*Password Check*/
function passwordStrength(password)
{
	var desc = new Array();
	desc[0] = "Very Weak";
	desc[1] = "Weak";
	desc[2] = "Better";
	desc[3] = "Medium";
	desc[4] = "Strong";
	desc[5] = "Strongest";

	var score   = 0;

	//if password bigger than 6 give 1 point
	if (password.length > 6) score++;

	//if password has both lower and uppercase characters give 1 point	
	if ( ( password.match(/[a-z]/) ) && ( password.match(/[A-Z]/) ) ) score++;

	//if password has at least one number give 1 point
	if (password.match(/\d+/)) score++;

	//if password has at least one special caracther give 1 point
	if ( password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) )	score++;

	//if password bigger than 12 give another 1 point
	if (password.length > 12) score++;

	 document.getElementById("passwordDescription").innerHTML = desc[score];
	 document.getElementById("passwordStrength").className = "strength" + score;
}


/*Date Validate*/

function checkdate (m, d, y) {
    return m > 0 && m < 13 && y > 0 && y < 32768 && d > 0 && d <= (new Date(y, m, 0)).getDate();
}
function isDate(dtStr){
	var objdate = dtStr.split('/');
	if(objdate.length!=3)return false;
	return !checkdate(objdate[1],objdate[0],objdate[2]);

}
