// JavaScript Document


// JScript File
function getFormNameValues(form,complete)
{
        if(!form)
            return "";
        var formLength = form.length;
        var formNames  = "";
        //alert(formLength);
    	for(var i = 0; i < formLength; i++) {
    	    if(form[i].name != ""){
    	    //alert(formNames.indexOf(form[i].name +","));
	                if(complete){
	                formNames = "Data has been fill out!";
	                    if(form[i].type=="radio")
                            form[i].checked = true;
	                    else if(form[i].type=="checkbox")
                            form[i].checked = true;
	                    else if(form[i].type=="textarea")
                            form[i].value = form[i].name;
	                    else if(form[i].type=="text")
                            form[i].value = form[i].name;
                    }
                    else
	                    if(formNames.indexOf(form[i].name +",")==-1)
                            formNames += form[i].name +",";
                //alert(form[i].name);
           }
       }
        return formNames;
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
		    if(radioObj.type == "textarea")
		        return radioObj.value;
		     else if (radioObj[i].type == "text")
		     	return radioObj[i].value;
		    else
			    return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}else{
		    if(radioObj[i].type == "textarea"){
		        return radioObj[i].value;
		     }
		     else if (radioObj[i].type == "text"){
		     	return radioObj[i].value;
		     }
		}
	}
	return "";
}
function parseEmail(szText)
{
	//var re = new RegExp("\w+\@[\w\-]+\.\w+\.?\w*","");
	var re=/\w+\@[\w\-]+\.\w+\.?\w*/;
	return ( re.test(szText) );
}
function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  
  if ( secure )
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}
function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );

  if ( results )
    return ( unescape ( results[1] ) );
  else
    return null;
}
function show() { 
        //JavaScript:show('Puppy Pre-school Objectives Content');
		   a=show.arguments; 
		       for(i=0; i<a.length; i++)
                {
	                            if (document.getElementById) 
	                            { // DOM3 = IE5, NS6
		                            if (document.getElementById(a[i]).style.display == "none"){
			                            document.getElementById(a[i]).style.display = 'block';
		                            //	filter(("img"+id),'imgin');			
		                            }	
	                            } 
	                            else 
	                            { 
		                            if (document.layers) 
		                            {	
			                            if (document.a[i].display == "none"){
				                            document.a[i].display = 'block';
			                            //	filter(("img"+id),'imgin');
			                            }
		                            } 
		                            else 
		                            {
			                            if (document.all.a[i].style.visibility == "none"){
				                            document.all.a[i].style.display = 'block';
			                            }
		                            }
		                      }
	            }
        }
		
		function hide() { 
        //JavaScript:hide('Content','ACMarketingHelp_Off');
		   a=hide.arguments; 
		       for(i=0; i<a.length; i++)
                {
	                            if (document.getElementById) 
	                            { // DOM3 = IE5, NS6
		                            if (document.getElementById(a[i]).style.display == "block"){
			                            document.getElementById(a[i]).style.display = 'none';			
		                            }	
	                            } 
	                            else 
	                            { 
		                            if (document.layers) 
		                            {	
			                            if (document.a[i].display == "block"){
				                            document.a[i].display = 'none';
			                            }
		                            } 
		                            else 
		                            {
			                            if (document.all.a[i].style.visibility == "block"){
				                            document.all.a[i].style.display = 'none';
			                            }
		                            }
		                      }
	            }
        }
// Querystring functions        
function PageQuery(q) {
    if(q.length > 1) this.q = q.substring(1, q.length);
    else this.q = null;
    this.keyValuePairs = new Array();
    if(q) {
            for(var i=0; i < this.q.split("&").length; i++) {
            this.keyValuePairs[i] = this.q.split("&")[i];
            }
        }
    this.getKeyValuePairs = function() { return this.keyValuePairs; }
    this.getValue = function(s) {
            for(var j=0; j < this.keyValuePairs.length; j++) {
            if(this.keyValuePairs[j].split("=")[0] == s)
            return this.keyValuePairs[j].split("=")[1];
            }
            return false;
        }
    this.getParameters = function() {
            var a = new Array(this.getLength());
                for(var j=0; j < this.keyValuePairs.length; j++) {
                a[j] = this.keyValuePairs[j].split("=")[0];
                }
            return a;
        }
        this.getLength = function() { return this.keyValuePairs.length; } 
}
// JavaScript:alert(queryString('FirstName'))
function queryString(key){
    var page = new PageQuery(window.location.search); 
    return unescape(page.getValue(key)); 
}
function displayItem(key){
    if(queryString(key)=='false') 
    {
        document.write("you didn't enter a ?name=value querystring item.");
    }else{
        document.write(queryString(key));
    }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

