﻿function chkBrowser(){
// alert(navigator.appName)
// alert(parseInt(navigator.appVersion))
if (navigator.appName != "Microsoft Internet Explorer" || parseInt(navigator.appVersion) < 4 ){
	alert("Please use Microsoft IE5 or IE6 to view the website.")
}

}

function showWMFlash(id,src,strFlashVars,w,h,bgcolor){
	document.write ('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
	document.write ('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
	document.write ('WIDTH="'+w+'" HEIGHT="'+h+'" id="'+id+'" ALIGN=""> ');
	document.write ('<PARAM NAME=movie VALUE="'+src+'"> ');
	document.write ('<PARAM NAME=quality VALUE=best>');
	document.write ('<PARAM NAME=bgcolor VALUE='+bgcolor+'>');
	document.write ('<PARAM NAME=menu value=0>');
	document.write ('<PARAM NAME=scale value=noborder>');
	document.write ('<PARAM NAME=FlashVars value="'+strFlashVars+'">');
	document.write ('<EMBED src="'+src+' quality=best scale=noborder menu=0 bgcolor='+bgcolor+' ');
	document.write ('WIDTH="'+w+'" HEIGHT="'+h+'" NAME="'+id+'" ALIGN="" ');
	document.write ('TYPE="application/x-shockwave-flash" ');
	document.write ('PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" flashvars="'+strFlashVars+'"></EMBED></OBJECT>');
}

function showECQFlash(id,src,w,h,bgcolor){
	document.write ('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
	document.write ('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
	document.write ('WIDTH="'+w+'" HEIGHT="'+h+'" id="'+id+'" ALIGN=""> ');
	document.write ('<PARAM NAME=movie VALUE="flash/'+src+'"> ');
	document.write ('<PARAM NAME=quality VALUE=best> <PARAM NAME=bgcolor VALUE='+bgcolor+'> ');
	document.write ('<PARAM NAME=wmode>');
	document.write ('<EMBED src="flash/'+src+'" quality=best bgcolor='+bgcolor+' ');
	document.write ('WIDTH="'+w+'" HEIGHT="'+h+'" NAME="'+id+'" ALIGN="" ');
	document.write ('TYPE="application/x-shockwave-flash" ');
	document.write ('PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
}

function simpleAlert(str){
alert(str)
}

function signUpAlert(str){
alert(str)
}

function resizeImage(name,file,front,iwidth){
	arFile = file.split(".")
	file1 = ""
	
	for (i=0;i<=arFile.length-2;i++)
	{
		//alert(arFile[arFile.length-2]);
		file1=file1+arFile[i]
		if (i!=arFile.length-2)
		{
			file1=file1+"."
		}
		
	}
		
	file1 = file1 + "a." + arFile[arFile.length-1]	
	var today=new Date()
	var time=today.getSeconds()
	if (front){
		document.write("<img id="+name+" src="+file1+"?"+time.valueOf()+" width="+iwidth+" border=0>")
	}else{
		document.write("<img id="+name+" src="+file1+"?"+time.valueOf()+" border=0>")
	}

}

function resizeImage2(file){
	var image0 =new Image();
	var iHeight, iWidth 
	var today=new Date()
	var time=today.getSeconds()
	image0.src =file + "?"+time.valueOf();	

	//document.images['p1'].src=image0.src;
	// alert(image0.src)
	//  alert(image0.width)
	//	 alert(image0.height)
	if (image0.width > image0.height){
		iHeight = (100 / image0.width) * image0.height
		iWidth=100}
	else{
		iWidth = (100 / image0.height) * image0.width
		iHeight=100
	}
	// alert(iWidth)
	// alert(iHeight)
		
	document.write("<img src="+file+" border=0 width="+iWidth+" height=" + iHeight + ">")

}

function resizeImage3(name,file,front){
	arFile = file.split(".")
	file1 = arFile[0] + "a." + arFile[1]	
	var today=new Date()
	var time=today.getSeconds()
	if (front){
		document.write("<img id="+name+" src="+file1+"?"+time.valueOf()+" height=68 border=1>")
	}else{
		document.write("<img id="+name+" src="+file1+"?"+time.valueOf()+" border=1>")
	}

}

function chgCountry(){			
	if (document.all.country.options[document.all.country.selectedIndex].value=="99")
		{document.all.sOtherCountry.style.display = "inline"}
	else
		{document.all.sOtherCountry.style.display = "none"}

}

function chgOccupation(){			
	if (document.all.occupation.options[document.all.occupation.selectedIndex].value=="999")
		{document.all.sOtherOccupation.style.display = "inline"}
	else
		{document.all.sOtherOccupation.style.display = "none"}

}

function chgOccupation2(){			
	if (document.all.occupation2.options[document.all.occupation2.selectedIndex].value=="999")
		{document.all.sOtherOccupation2.style.display = "inline"}
	else
		{document.all.sOtherOccupation2.style.display = "none"}

}

function occupationLstBox(fld, val, style){
	var ar =  arSelect0.concat(arOther.concat(arStudent.concat(arRetailTitle.concat(arRetail.concat(arManufactureTitle.concat(arManufacture.concat(arProfessionalTitle.concat(arProfessional.concat(arGovernmentTitle.concat(arGovernment.concat(arTravelTitle.concat(arTravel.concat(arBuildTitle.concat(arBuild.concat(arMediaTitle.concat(arMedia.concat(arPublicTitle.concat(arPublic))))))))))))))))))
	lstBox2(fld,ar,val,(style=null?"class=field":style))
}

function lstBox2(lstName,ar,val,style){
	document.open()
	document.writeln("<select name=" + lstName + (style==""?"":" " +style) + ">")
	for(var i=0;i<ar.length;i+=2)
		document.writeln("<option value='"+ar[i] + "'" + (ar[i]==val?" selected":"") + (ar[i]==""?"style='background-color:gray;color:white'":"") + ">" + ar[i].toString() + " " + ar[i+1] + "</option>")
	document.writeln("</select>")
	document.close()
					
}

function lstBox(lstName,ar,val,style){
	document.open()
	document.writeln("<select name=" + lstName + (style==""?"":" " +style) + ">")
	for(var i=0;i<ar.length;i+=2)
		document.writeln("<option value='"+ar[i] + "'" + (ar[i]==val?" selected":"") + ">" + ar[i+1] + "</option>")
		document.writeln("</select>")
		document.close()
					
}

//Develop by Anna on 2007.03.14 for databinding of dropdown not referring database
function bind_LstBox(lstName,ar,val,style,bindField){
	document.open()
	document.writeln("<select id=" + lstName + " name=" + lstName + (style==""?"":" " +style) + " onchange=bindData('"+lstName+"','"+bindField+"')>")
	for(var i=0;i<ar.length;i+=2)
		document.writeln("<option value='"+ar[i] + "'" + (ar[i]==val?" selected":"") + ">" + ar[i+1] + "</option>")
		document.writeln("</select>")
		document.close()
					
}

//Develop by Anna on 2007.03.14 for databinding of dropdown not referring database
function bind_LstBox2(lstName,ar,val,style,bindField){
	document.open()
	for(var i=0;i<ar.length;i+=2)
		document.writeln("<option value='"+ar[i] + "'" + (ar[i]==val?" selected":"") + ">" + ar[i+1] + "</option>")
		document.close()
					
}

//Develop by Anna on 2007.03.14 for databinding of dropdown not referring database
function bind_LstBox(lstName,ar,val,style,bindField){
	document.open()
	document.writeln("<select id=" + lstName + " name=" + lstName + (style==""?"":" " +style) + " onchange=bindData('"+lstName+"','"+bindField+"')>")
	for(var i=0;i<ar.length;i+=2)
		document.writeln("<option value='"+ar[i] + "'" + (ar[i]==val?" selected":"") + ">" + ar[i+1] + "</option>")
		document.writeln("</select>")
		document.close()
					
}

//Develop by Anna on 2007.03.14 for databinding of dropdown not referring database
function bindData(lstName,bindField) {
    var bindedField = eval("document.forms[0]."+bindField);
    var list = eval("document.forms[0]."+lstName);
    bindedField.value = list.options[list.selectedIndex].value;
    alert(bindedField.value);
}

function lstBoxTest(lstName,ar,val){

	var list = eval("document.forms[0]."+lstName);
	
	for(var i=0;i<ar.length;i+=2)
	{
		var oOption = document.createElement("OPTION");
		oOption.text=ar[i+1];
		oOption.value=ar[i];
		list.add(oOption);

	}
	for(var i=0;i<ar.length;i+=2)
	{	
		var k=i/2;

		if (ar[i]==val)
			list.options[k].selected=true;
	}				
}



function chkBox(name,ar,val,colNum,style){
	document.open()
	document.writeln("<table cellpadding=3 cellspacing=3 border=0 class=tbl>")
	for(var i=0;i<ar.length;i+=colNum*2){
		document.writeln("<tr>")
		for(var j=0;j<colNum*2;j+=2){
		if (i+j<ar.length)
			document.writeln("<td><input type=checkbox name='"+name+"' value='"+ar[i+j]+"'"  + (nullToEmpty(style) ==""?"":style) + (val.indexOf("|"+ar[i+j]+"|",0)>=0?" checked":"") + " > " + ar[i+j+1] + "</td>")
		else
			document.writeln("<td>&nbsp;</td>")
		}

		document.writeln("<tr>")
	}
	document.writeln("</table>")
	document.close()
}
					
					
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function changeClass(a, b) { //v3.1
  a.className=b;
}




function wrFlash(id,src,w,h,bgcolor){
document.write ('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
document.write ('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
document.write ('WIDTH="'+w+'" HEIGHT="'+h+'" id="'+id+'" ALIGN=""> ');
document.write ('<PARAM NAME=movie VALUE="flash/'+src+'"> ');
document.write ('<PARAM NAME=quality VALUE=best> <PARAM NAME=bgcolor VALUE='+bgcolor+'> ');
document.write ('<EMBED src="flash/'+src+'" quality=high bgcolor='+bgcolor+' ');
document.write ('WIDTH="'+w+'" HEIGHT="'+h+'" NAME="'+id+'" ALIGN="" ');
document.write ('TYPE="application/x-shockwave-flash" ');
document.write ('PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
}

function showVal(ar,val,emptyStr){
	var tmpStr = ""
	if (emptyStr) tmpStr = emptyStr
	for(var i=0;i<ar.length;i+=2)
		if (val==ar[i])	{tmpStr = ar[i+1]}
	if (tmpStr == "")
	{
		tmpStr = ""
	}
	document.write(tmpStr)
}

function showMultiItem(str,ar){
	var tmpStr = ""
	if (str != "" && str !="||"){
		var arTmp = str.split("|")

		for (var i=1;i<arTmp.length-1;i++){
			if (tmpStr != "") tmpStr = tmpStr + ", "
				for (var j=0;j<ar.length;j=j+2)
				{
					if (arTmp[i] == ar[j]){
					tmpStr = tmpStr + ar[j+1];break;
					}
				}
		}
	}
	if (tmpStr == "")
	{
		tmpStr = "test"
	}

	document.write(tmpStr)
}


function showOccupationTitle(val){
	var tmpStr = ""
	num = parseInt(val)
	if (num > 0)
	{
		if (num < 100)
		{
			tmpStr = arRetailTitle[1] + " - "

		}
		else if (num < 200)
		{
			tmpStr = arManufactureTitle[1] + " - "
		}
		else if (num < 300)
		{
			tmpStr = arProfessionalTitle[1] + " - "
		}
		else if (num < 400)
		{
			tmpStr = arGovernmentTitle[1] + " - "
		}
		else if (num < 500)
		{
			tmpStr = arTravelTitle[1] + " - "
		}
		else if (num < 600)
		{
			tmpStr = arBuildTitle[1] + " - "
		}
		else if (num < 700)
		{
			tmpStr = arMediaTitle[1] + " - "
		}
		else if (num < 800)
		{
			tmpStr = arPublicTitle[1] + " - "
		}
	}

	document.write(tmpStr)
}

function deleteall(thevalue, clientID)
{
	var allCheckBox = document.getElementsByTagName("input");
	for (var i=0; i<allCheckBox.length; i++)
	{
		if (allCheckBox(i).type == "checkbox" && allCheckBox(i).name.substr(clientID.length+1, 4) == "del_")
		{
			allCheckBox(i).checked = thevalue;
		}
	}
}

function ProcessSelect(clientID, targetID)
{
	var selectpkey = "";
	var selectitems = eval("document.forms[0]."+clientID+"_SelectItems");
	var allcheckbox = document.getElementsByTagName("input");
	for (var i=0; i<allcheckbox.length; i++)
	{
		if (allcheckbox(i).type=="checkbox" && allcheckbox(i).name.substr(clientID.length+1, 4) == "sel_" && allcheckbox(i).name.substr(clientID.length+1+4) != "All")
		{
			if (allcheckbox(i).checked) selectpkey += allcheckbox(i).name.substr(clientID.length+1+4) + ";";
		}
	}
	//if (selectpkey.substr(selectpkey.length-1)==";") selectpkey = selectpkey.substr(0, selectpkey.length-1);
	selectitems.value = selectpkey;
	window.opener.document.getElementById(targetID).value += selectitems.value
	window.close();
}

function ProcessDelete(clientID)
{
	var deletepkey = "";
	var deleteitems = eval("document.forms[0]."+clientID+"_DeleteItems");
	var allcheckbox = document.getElementsByTagName("input");
	for (var i=0; i<allcheckbox.length; i++)
	{
		if (allcheckbox(i).type=="checkbox" && allcheckbox(i).name.substr(clientID.length+1, 4) == "del_")
		{
			if (allcheckbox(i).checked) deletepkey += allcheckbox(i).name.substr(clientID.length+1+4) + ",";
		}
	}
	if (deletepkey.substr(deletepkey.length-1)==",") deletepkey = deletepkey.substr(0, deletepkey.length-1);
	deleteitems.value = deletepkey;
}


//show salary
function wrSalary(sf,st){
	var retStr
	if (sf==st){
		if (sf==0)
		{
			retStr="Negotiable"
		}else {
			retStr=ntok(sf)
		}
	}
	else {retStr=ntok(sf)+" - "+ntok(st)}
	document.write(retStr)
}

function mouseOver(bname)
{
    if (bname=="a1") 
    {document.a1.src ="pic/home_on.gif"}

    if (bname=="b1") 
    {document.b1.src ="pic/aboutAmple_on.gif"}

    if (bname=="c1") 
    {document.c1.src ="pic/visionAndCoreValues_on.gif"}

    if (bname=="d1") 
    {document.d1.src ="pic/services_on.gif"}

    if (bname=="e1") 
    {document.e1.src ="pic/professional_on.gif"}

    if (bname=="f1") 
    {document.f1.src ="pic/wealth_on.gif"}

    if (bname=="g1") 
    {document.g1.src ="pic/newsletter_on.gif"}

    if (bname=="h1") 
    {document.h1.src ="pic/ample_on.gif"}

    if (bname=="i1") 
    {document.i1.src ="pic/ampleclub_on.gif"}

    if (bname=="j1") 
    {document.j1.src ="pic/link_on.gif"}

    if (bname=="k1")
    {document.k1.src ="pic/contactUs_on.gif"}
    
    if (bname=="l1")
    {document.l1.src ="pic/joinOurP_on.gif"}
}

function mouseOut(bname)
{

    if (bname=="a1") 
    {document.a1.src ="pic/home.gif"}

    if (bname=="b1") 
    {document.b1.src ="pic/aboutAmple.gif"}

    if (bname=="c1") 
    {document.c1.src ="pic/visionAndCoreValues.gif"}

    if (bname=="d1") 
    {document.d1.src ="pic/services.gif"}

    if (bname=="e1") 
    {document.e1.src ="pic/professional.gif"}

    if (bname=="f1") 
    {document.f1.src ="pic/wealth.gif"}

    if (bname=="g1") 
    {document.g1.src ="pic/newsletter.gif"}

    if (bname=="h1") 
    {document.h1.src ="pic/ample.gif"}

    if (bname=="i1") 
    {document.i1.src ="pic/ampleclub.gif"}

    if (bname=="j1") 
    {document.j1.src ="pic/link.gif"}

    if (bname=="k1")
    {document.k1.src ="pic/contactUs.gif"}
    
    if (bname=="l1")
    {document.l1.src ="pic/joinOurP.gif"}
}