/***********************************************
* Disable "Enter" key in Form script- By Nurul Fadilah(nurul@REMOVETHISvolmedia.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
var doAlerts=false;
function changeSheets(whichSheet){
  whichSheet=whichSheet-1;
  if(document.styleSheets){
    var c = document.styleSheets.length;
    if (doAlerts) alert('Change to Style '+(whichSheet+1));
    for(var i=0;i<c;i++){
      if(i!=whichSheet){
        document.styleSheets[i].disabled=true;
      }else{
        document.styleSheets[i].disabled=false;
      }
    }
  }
}

<!-- Idea by:  Nic Wolfe (Nic@TimelapseProductions.com) -->
<!-- Web URL:  http://fineline.xs.mw -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,status=0,location=0,menubar=0,resizable=1,width=820,height=600,left = 240,top = 212');");
}








                
function handleEnter (field, event) {
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		} 
		else
		return true;
	}      

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function ToggleCheckBoxes(selectID)  {
     var list=document.getElementById(selectID);
  for (i = 0; i <= list.length - 1; i++)  {
       if (list.options[i].selected == true)     {
               if (list.options[i].value == "contemporary | modern")  {

                    divX2=document.getElementById("chkmenu2");
                    divX2.style.display = "";
                    divX4=document.getElementById("chkmenu4");
                    divX4.style.display = "none";
 
               } else if (list.options[i].value == "other - type in"){
    

                    divX2=document.getElementById("chkmenu2");
                    divX2.style.display = "none";
                    divX4=document.getElementById("chkmenu4");
                    divX4.style.display = "";
               
                  
                  } else {
    

                    divX2=document.getElementById("chkmenu2");
                    divX2.style.display = "none";
                    divX4=document.getElementById("chkmenu4");
                    divX4.style.display = "none";
               
                  
                  }
               
       }
  }
}

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function ToggleCheckBoxes2(selectID)  {
     var list=document.getElementById(selectID);
  for (i = 0; i <= list.length - 1; i++)  {
       if (list.options[i].selected == true)     {
               if (list.options[i].value == "other - type in")  {

                    divX3=document.getElementById("chkmenu3");
                    divX3.style.display = "";
 
                  } else {

                    divX3=document.getElementById("chkmenu3");
                    divX3.style.display = "none";
               
                  
                  }
               
       }
  }
}
/*
Submit Once form validation- 
&#169; Dynamic Drive (www.dynamicdrive.com)
For full source code, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/

function submitonce(theform){
//this.submitbutton.value = "  Sending...  ";
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" and "reset"
	for (i=0;i<theform.length;i++){
		var tempobj=theform.elements[i]
		if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
			tempobj.value="working... W A I T"
			//disable em
			//tempobj.disabled=true
		}
	}
	if (document.all||document.getElementById){
	//screen thru every element in the form, and hunt down "submit" and "reset"
		for (i=0;i<theform.length;i++){
			var tempobj=theform.elements[i]
			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
				//tempobj.value=""
				//disable em
				tempobj.disabled=true
			}
		}		
	if (document.all||document.getElementById){
	//screen thru every element in the form, and hunt down "submit" and "reset"
		for (i=0;i<theform.length;i++){
			var tempobj=theform.elements[i]
			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
				//tempobj.value=""
				//disable em
				tempobj.className = "working"
			}
		}		
}


//Original:  ArjoGod, Shauna Merritt -->
//Modified By:  Ronnie T. Moore, Editor -->

//This script and many more are available free online at -->
//The JavaScript Source!! http://javascript.internet.com -->

//Begin
extArray = new Array(".gif", ".jpg");
function validatefile(form, file, title1, credits){

	if (!file) {
	   alert( "Please specify JPG or GIF file to upload." );
    	form.upfile.focus();
    	return false;
	} else {
		
		allowSubmit = false;
		
		while (file.indexOf("\\") != -1){
			file = file.slice(file.indexOf("\\") + 1);
		}
		ext = file.slice(file.indexOf(".")).toLowerCase();
		for (var i = 0; i < extArray.length; i++) {
			if (extArray[i] == ext) { 
				allowSubmit = true;
				//break;
			}
		}
		
		
		
		
		if (!allowSubmit){
			alert("Please only upload files that end in types:  " 
			+ (extArray.join("  ")) + "\nPlease select a new "
			+ "file to upload and submit again.");
	   	form.upfile.value = "";
	   	form.upfile.focus();
			return false ;
		} else {
		  	var LimitedSize = true;
			
			document.getElementById("ShowImg").innerHTML= "<img id='Sample' src='" + file + "' width='1' height='1'></img>";
			var y = document.images;
			for (i=0;i<y.length;i++){
				if((y[i].id) == 'Sample'){
					if(y[i].fileSize > 204800){
					LimitedSize = false;
					}
				}
			}
			
			if(!LimitedSize){
			 	alert("File Size is more than 200 KB");
				document.getElementById("ShowImg").innerHTML= "";
		   	form.upfile.value = "";
		   	form.upfile.focus();
				return false;
			}
		}
	}
}
extArray = new Array(".gif", ".jpg");
function validatefile2(form, file, title1, credits){

	if (!file) {
	   alert( "Please specify JPG or GIF file to upload." );
    	form.upfile.focus();
    	return false;
	} else if (!title1) {	
   	alert( "Please enter photo title." );
    	form.title.focus();
    	return false;
  	} else if (!credits) {
    	alert( "Please enter photo credits." );
    	form.credits.focus();
    	return false;
	}

	allowSubmit = false;
	
	while (file.indexOf("\\") != -1){
		file = file.slice(file.indexOf("\\") + 1);
	}
	ext = file.slice(file.indexOf(".")).toLowerCase();
	for (var i = 0; i < extArray.length; i++) {
		if (extArray[i] == ext) { 
			allowSubmit = true;
			//break;
		}
	}
	if (!allowSubmit){
		alert("Please only upload files that end in types:  " 
		+ (extArray.join("  ")) + "\nPlease select a new "
		+ "file to upload and submit again.");
   	form.upfile.value = "";
   	form.upfile.focus();
		return false ;
	}
	
return true;
}








/***********************************************
* Form Field Progress Bar- By Ron Jonk- http://www.euronet.nl/~jonkr/
* Modified by Dynamic Drive for minor changes
* Script featured/ available at Dynamic Drive- http://www.dynamicdrive.com
* Please keep this notice intact
***********************************************/

function textCounter(field,counter,maxlimit,linecounter) {
	// text width//
	var fieldWidth =  parseInt(field.offsetWidth);
	var charcnt = field.value.length;        

	// trim the extra text
	if (charcnt > maxlimit) { 
		field.value = field.value.substring(0, maxlimit);
	}

	else { 
	// progress bar percentage
	var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
	document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
	document.getElementById(counter).innerHTML="Limit: "+percentage+"%"
	// color correction on style from CCFFF -> CC0000
	setcolor(document.getElementById(counter),percentage,"background-color");
	}
}

function setcolor(obj,percentage,prop){
	obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}

















































//Begin
extArray = new Array(".gif", ".jpg");
function validatefile3(form, file){
	allowSubmit = false;
	if (!file) return;
	while (file.indexOf("\\") != -1){
		file = file.slice(file.indexOf("\\") + 1);
	}
	ext = file.slice(file.indexOf(".")).toLowerCase();
	for (var i = 0; i < extArray.length; i++) {
		if (extArray[i] == ext) { 
			allowSubmit = true;
			//break;
		}
	}
	if (allowSubmit){
		form.submit();
	} else {
		alert("Please only upload files that end in types:  " 
		+ (extArray.join("  ")) + "\nPlease select a new "
		+ "file to upload and submit again.");
   	form.upfile.value = "";
   	form.upfile.focus();
		return false ;
	}
return true;
}

function checkform ( form )
{
  // ** 
	if (form.title.value == "") {
   	alert( "Please enter photo title." );
    	form.title.focus();
    	return false ;
  	}
  	if (form.credits.value == "") {
    	alert( "Please enter photo credits." );
    	form.credits.focus();
    	return false ;
  	}

  // ** 
  return true ;
}
//  End -->


function imgLoad()
{
	var strT = new String();
	document.getElementById("ShowImg").innerHTML= "";
	strT = document.ModReg.upfile.value;
	if(strT != ""){
		strT = "<img id='Sample' src='" + strT + "' width='100' height='100'></img>";
		document.getElementById("ShowImg").innerHTML= strT;
		if(!LimitedSize()){
			alert("File Size is more than 100 KB");
			document.getElementById("ShowImg").innerHTML= "";
		}
	}
}

function LimitedSize()
{
var i;
var y = document.images;
for (i=0;i<y.length;i++)
{
if((y[i].id) == 'Sample')
{
if(y[i].fileSize > 102400)
return false;
}
}
return true;
}

