
var cssmenuids=["cssmenu1"]
var csssubmenuoffset=-1
function createcssmenu2(){for(var i=0;i<cssmenuids.length;i++){var ultags=document.getElementById(cssmenuids[i]).getElementsByTagName("ul")
for(var t=0;t<ultags.length;t++){ultags[t].style.top=ultags[t].parentNode.offsetHeight+csssubmenuoffset+"px"
var spanref=document.createElement("span")
spanref.className="arrowdiv"
spanref.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;"
ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref)
ultags[t].parentNode.onmouseover=function(){this.style.zIndex=100
this.getElementsByTagName("ul")[0].style.visibility="visible"
this.getElementsByTagName("ul")[0].style.zIndex=0}
ultags[t].parentNode.onmouseout=function(){this.style.zIndex=0
this.getElementsByTagName("ul")[0].style.visibility="hidden"
this.getElementsByTagName("ul")[0].style.zIndex=100}}}}
if(window.addEventListener)
window.addEventListener("load",createcssmenu2,false)
else if(window.attachEvent)
window.attachEvent("onload",createcssmenu2)

//if (top.location != location) {top.location.href = document.location.href; }
function validate_rating(){
  var daform = document.getElementById('Poll1');
  	for (x=0; x < 5; x++) {	
  	//alert(daform.poem_quality[x].checked)
  		if(daform.poem_quality[x].checked){
			daform.submit();
			return true;
  			}
  		}
		alert ( "Rate The Poem!" );
	    daform.focus();
	    return false;
}
function popup1(page, w, h)  
	{  
	options = "toolbar=0,status=0,menubar=0,scrollbars=1,resizable=1,left=200,top=200,width=" + w + ",height=" + h;  
	window.open(page, "Popup1", options);  
	}  
function hide(id)
{
	var obj = document.getElementById(id);
	obj.style.display = obj.style.display == "none" ? "block" : "none";
}
function checkform(frm){
var answer = frm.long_answer.value;
	if( answer === ""  ){
				alert("Your Answer is missing");
				frm.long_answer.focus();
				return false;
			}

		var stopspam = frm.user_answer2.value;
	if (stopspam === ""){
			alert("Please Help us block spam by answering the question");
				frm.user_answer2.focus();
				return false;	
		}
	return true;
}

function validate_survey(){	
	//with (document.poll4) {	  
  var survey_form = document.getElementById('survey_form');

	  if ( (survey_form.gender[0].checked == false ) && (survey_form.gender[1].checked == false ) ) {
        alert ( "Please choose your Gender: Male or Female. Thank You!" );
        survey_form.gender[0].focus();
        return false;
   		}		

 	for (x=0; x < 9; x++) {	
			if(survey_form.age[x].checked){
				return true;
				}
			}			
        alert ( "Please choose your Age/Demographic. Thank You!" );
        survey_form.age[0].focus();
        return false;
		
		if (survey_form.user_answer.value == ""){
			alert("Please Help us block spam by answering the question");
			survey_form.user_answer.focus();
			return false;	
		}
	}
// The following are used by the comments form
CommentsValidator = {
    // highlights a form field w/ a missing value
    highlightElement: function(element) {
        element.style.background = '#fcea10';
    },
    // removes highlighting
    resetElement: function(element) {
        element.style.background = '';
    },
    // adds a message saying that a field is invalid
    addWarning: function(message) {
        var element = document.getElementById('warnings');
        element.innerHTML = element.innerHTML + '<li>' + message + '</li>';
        element.style.display = 'block';
    },
    // removes all messages
    clearWarnings: function() {
        var element = document.getElementById('warnings');
        element.innerHTML = '';
        element.style.display = 'none';
    },
    // turnkey: checks the add a comment form for completeness
    validateForm: function() {
        var author = document.getElementById('author');
        var comment_email = document.getElementById('comment_email');
        var new_comment = document.getElementById('new_comment');
        var user_answer = document.getElementById('user_answer');
        var ret = true;

        // reset state from previous invokation
        this.clearWarnings();
        this.resetElement(author);
        this.resetElement(comment_email);
        this.resetElement(new_comment);
		this.resetElement(user_answer);
		
        // author must have a value
        if (!author.value) {
            this.highlightElement(author);
            this.addWarning('Please enter your name');
            ret = false;
        }
        // email must have a value
        if (!comment_email.value) {
            this.highlightElement(comment_email);
            this.addWarning('Please enter your e-mail address');
            ret = false;
        }
        // email must be valid: defined as containing one dot (.) and one
        // at sign (@) with the at sign coming first.
        if (comment_email.value) {
            var atpos = comment_email.value.lastIndexOf('@');
            var dotpos = comment_email.value.lastIndexOf('.');

            if (atpos < 0 || dotpos < atpos) {
                this.highlightElement(comment_email);
                this.addWarning('That e-mail address is not valid');
                ret = false;
            }
        }
        // comments must have a value
        if (!new_comment.value) {
            this.highlightElement(new_comment);
            this.addWarning('Please enter your comment');
            ret = false;
        }     
          // comments must be less then 1000 chars
        if (new_comment.value.length > 1000) {
            this.highlightElement(new_comment);
            this.addWarning('Comment is ' + new_comment.value.length  + ' characters.\n\n Comment must be less then 1000 characters. ');
            ret = false;
        }
        if (!user_answer.value) {
            this.highlightElement(user_answer);
            this.addWarning('Please answer the Anti-Spam question');
            ret = false;
        }
        if (ret == true) {
            alert('Your comment will not appear right away. \n\nAll comments are moderated.');        }
        return ret;
    }
}