

	function switchURL( aURL, aVariableList, aValue ) {		// view selected URL
		
		location.href = aURL + "&" + aVariableList + aValue;
		
	}

	// VARIABLE DECLARATIONS
	bname = navigator.appName;
	bver = parseInt(navigator.appVersion);
	blegal = ((bname == "Netscape" && bver >= 3) || (bname == "Microsoft Internet Explorer" && bver >= 4));
	var lastcount = 0;
	var password_extra = '';

	function checkMessageLength(form,field,maxLength,onSubmit,checkLength,splitcheck){
		if( checkMessageLength.arguments.length == 4) { checkLength = true; splitcheck = false; }
		if( checkMessageLength.arguments.length == 5) splitcheck = false;
		if( checkLength == false ) return true;
		var count = countChars(form,field);
		var rc = true;
		if( ( count > maxLength && onSubmit == 1 ) || ( count > maxLength && onSubmit == 0 && count != lastcount ) ){
			alert( mlTooManyCharsPre + maxLength + mlTooManyCharsPost );
			form[field].focus();
			rc = false;
		} else if( count > maxLength ) {
			rc = false;		
		}
		lastcount = count;
		return rc;
	}


	function countChars(form,field){
		if( blegal ){
			var count = form[field].value.length;
			form.count.value = count;
			return count;
		} else {
			return 0;
		}
	}
	
	
	function checkrequired( which ) {
		
		var pass = true;
		
		if ( document.images ) {
			for ( i = 0 ; i < document.forms[ which ].length ; i++ ) {
			
				var tempobj=document.forms[ which ].elements[i];
				
				if ( tempobj.name.substring(0,4) == 'req_' ) {
					if ( ( tempobj.type=="hidden" || tempobj.type=="text" || tempobj.type=="textarea" || tempobj.type.toString().charAt(0) == "s" ) && tempobj.value == '' ) {
						pass=false;
						break;
					}
					if ( tempobj.type=="radio" ) {
					
						var tempradio = document.forms[ which ].elements[ tempobj.name ];
						var radio_button_check = false;
						
						for ( counter = 0 ; counter < tempradio.length ; counter++ ) {
							// If a radio button has been selected it will return true
							// (If not it will return false)
							if ( tempradio[counter].checked )
							radio_button_check = true;
						}

						if ( radio_button_check == false ) {
							pass=false;
							break;
						}
					}
				}
				if ( tempobj.name.substring(0,9) == 'reqemail_' ) {
					split_at = tempobj.value.split('@');
					if ( !split_at[1] ) {
						pass=false;
						break;
					} else {
						split_dot = split_at[1].split('.');
						if ( split_at[0] == '' || !split_dot[0] || !split_dot[1] ) {
							pass=false;
							break;
						}
					}
				}
			}
		}
		if (!pass) {
			alert( mlAllRequiredFields );
			tempobj.focus();
			return false;
		} else 
		return true;
	}

	

	function setPassword(form,passfield,loginfield,namefield){
		if ( !password_extra ) {
			
			var klinkers = new Array('a','e','i','o','u','y');
			var medeklinkers = new Array('b','c','d','f','g','h','j','k','l','m','n','p','r','s','t','v','w','z');
			
			password_extra = password_extra + Math.round( Math.random() * 100 );
			password_extra = password_extra + medeklinkers[ ( Math.round( Math.random() * 100 ) ) % 18 ];
			password_extra = password_extra + klinkers[ ( Math.round( Math.random() * 100 ) ) % 6 ];
			password_extra = password_extra + medeklinkers[ ( Math.round( Math.random() * 100 ) ) % 18 ];

		}
		if( blegal ){
			if (form[namefield].value == "" ) {
				form[passfield].value = "";
				form[loginfield].value = "";
			} else {
				form[passfield].value = form[namefield].value.substring(0,3).toLowerCase() + password_extra;
				names = form[namefield].value.split(' ');
				form[loginfield].value = names[0].toLowerCase();
			}
			return true;
		} else {
			return false;
		}
	}
	
	
	function set_fg_color( color ) {
	
		document.template_form.form_foreground_color.value = color;
		document.template_form.req_form_hidden_fg_color.value = color;
		
		return true;
		
	}


	function set_bg_color( color ) {
	
		document.template_form.form_background_color.value = color;
		document.template_form.req_form_hidden_bg_color.value = color;
		
		return true;
		
	}


	function open_window( url , name , width , height , resizeable , scrollbars , menubar , status , directories , location , toolbar ) {
		
		var sSize = 'width='+width+', height='+height+', resizeable='+resizeable+', resizable='+resizeable+', scrollbars='+scrollbars+', menubar='+menubar+', status='+status+', directories='+directories+', location='+location+', toolbar='+toolbar;
		var sDate = new Date();
		var sTime = sDate.getSeconds() + "_" + sDate.getMinutes() + "_" + sDate.getHours();
		var newWindow = window.open(url,sTime,sSize); 
		
	}
	
	
	function break_frames() {
	
		if (parent.frames.length > 0) {
			parent.location.href = self.document.location
		}
		
	}
	

	function moveSelected ( select , down , hidden ) { 
	
		if (select.selectedIndex != -1) { 
		
			if (down) { 
				
				if (select.selectedIndex != select.options.length - 1) var x = select.selectedIndex + 1; 
				
				else return; 
			
			} else { 
			
				if (select.selectedIndex != 0) var x = select.selectedIndex - 1; 
				
				else return; 
			
			} 
			
			var swapOption = new Object(); 
			
			swapOption.text = select.options[select.selectedIndex].text; 
			swapOption.value = select.options[select.selectedIndex].value; 
			swapOption.selected = select.options[select.selectedIndex].selected; 
		//	swapOption.defaultSelected = select.options[select.selectedIndex].defaultSelected; 
			
			for (var property in swapOption) select.options[select.selectedIndex][property] = select.options[x][property]; 
			
			for (var property in swapOption) select.options[x][property] = swapOption[property];
			
			setHidden( select , hidden ); 
		
		} 
	
	} 
		
	function setHidden( select , hidden ) { 
	
		var destVals = new Array(), opt = 0, separator = '!'; 
		
		while ( select.options[opt] ) destVals[opt] = select.options[opt++].text; 
		
		hidden.value = destVals.join(separator); 
				
		return true;
		
	} 

	
	// Correctly handle PNG transparency in Win IE 5.5 or higher.
	// http://homepage.ntlworld.com/bobosola. Updated 02-March-2004
	
	function correctPNG() 
	   {
	   for(var i=0; i<document.images.length; i++)
		  {
		  var img = document.images[i];
		  var imgName = img.src.toUpperCase();
		  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
			 {
			 var imgID = (img.name) ? "id='" + img.name + "' " : "";
			 imgID = (img.id) ? "id='" + img.id + "' " : imgID;
			 var imgClass = (img.className) ? "class='" + img.className + "' " : "";
			 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
			 var imgStyle = "display:inline-block;" + img.style.cssText;
			 if (img.align == "left") imgStyle = "float:left;" + imgStyle;
			 if (img.align == "right") imgStyle = "float:right;" + imgStyle;
			 if (img.parentElement&&img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;	
			 var strNewHTML = "<span " + imgID + imgClass + imgTitle
			 + ' style="' + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
			 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			 + "(src='" + img.src + "', sizingMethod='scale');" + '"></span>'; 
			 img.outerHTML = strNewHTML
			 i = i-1
			 }
		  }
	   }
	 if (window.attachEvent) window.attachEvent("onload", correctPNG);

