//-----------------------------   Log in to the CMS

function EnterLogin() {

	if (event.keyCode == 13) {
		GoLogin();
	}
}

function SetFocusLogin() {

	if (document.adminlogin.dma_aid.value == "") {
		document.adminlogin.dma_aid.focus();
		return;
	}

}

function GoLogin() {

	if (document.adminlogin.dma_aid.value == "") {
		alert("You miss the CMS ID. Go back and retype please.");
		document.adminlogin.dma_aid.focus();
		return;
	}
	
	if (document.adminlogin.dma_apw.value == "") {
		alert("You miss the CMS Password. Go back and retype please.");
		document.adminlogin.dma_apw.focus();
		return;
	}
	
	document.adminlogin.submit();

}


//-----------------------------   Register the Project
function GoProjectWrite() {

	if (document.projectwrite.pn.value == "") {
		alert("You missed the Project Name. Please go back and provide it.");
		document.projectwrite.pn.focus();
		return;
	}

	if (document.projectwrite.cn.value == "") {
		alert("You missed the City Name. Please go back and provide it.");
		document.projectwrite.cn.focus();
		return;
	}
	
	if (document.projectwrite.file1.value == "") {
		alert("You missed the Thumbnail Image. Please go back and select it.");
		document.projectwrite.file1.focus();
		return;
	}

	document.projectwrite.submit();
	
}


//-----------------------------   Modify the Project
function GoProjectModify() {

	if (document.projectmodify.pn.value == "") {
		alert("You miss the Project name. Go back and retype please.");
		document.projectmodify.pn.focus();
		return;
	}

	if (document.projectmodify.cn.value == "") {
		alert("You miss the City name. Go back and retype please.");
		document.projectmodify.cn.focus();
		return;
	}

	document.projectmodify.submit();
	
}


//-----------------------------   The Project Delete case1
function ProjectDeleteCase1(category,num,pn,cn,page,flag1,flag2)
{
	ans = confirm("Remove the project in '" + cn + "'\n\nFrom the " + category + " list? It can not be recovered.");
	
	if(ans == true)
		document.location.href="project_deleteok.asp?num="+num+"&page="+page+"&flag1="+flag1+"&flag2="+flag2;
	else
		return;
}


//-----------------------------   The Project Delete case2
function ProjectDeleteCase2(category,num,pn,cn,page,flag1,flag2)
{
	ans = confirm("Remove '" + pn + "' in '" + cn + "'\n\nFrom the " + category + " list? It can not be recovered.");
	
	if(ans == true)
		document.location.href="project_deleteok.asp?num="+num+"&page="+page+"&flag1="+flag1+"&flag2="+flag2;
	else
		return;
}


//-----------------------------   Image Delete
function ImgDel(num,filenum,flag1,flag2,page)
{
	ans = confirm("Remove the image? It can not be recovered.");
	
	if(ans == true)
		document.location.href="project_imgdeleteok.asp?num="+num+"&filenum="+filenum+"&flag1="+flag1+"&flag2="+flag2+"&page="+page;
	else
		return;
}


//-----------------------------   Swap Image

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_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_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];}
}

