

    var closedd = 0;
    var opendd = 0;

    function deth_visibility(eleid, atvalue) /*v.5 Dethstarz function */
      {
         //case 1
         if (atvalue == 'visible') 
           {
            //closes current menu
            if (opendd) 
              {
               document.getElementById(opendd).style.visibility ='hidden';
               opendd = null;
              }
            //cancel timeout of menu close
            if (closedd)
              {
                window.clearTimeout(closedd);
                closedd = null;
              }
            //changes visibility value
            document.getElementById(eleid).style.visibility = atvalue;     
            opendd = eleid;
           }
         // case 2
         else if (atvalue == 'cancel')
           {
             //cancels timeout of menu close
             if (closedd)
               {
                 window.clearTimeout(closedd);
                 closedd = null;
               }
           }
         // case 3
         else // sets timeout of menu close
          {closedd = window.setTimeout("document.getElementById('" + eleid + "').style.visibility ='" + atvalue + "'", 1000);}
      }

function deth_email(fieldid, messtarget) /*v.5 dethstarz function*/
  {
    var apos= document.getElementById(fieldid).value.indexOf("@");
    var dotpos= document.getElementById(fieldid).value.lastIndexOf(".");
    if (apos<1||dotpos-apos<2) 
      {document.getElementById(messtarget).innerHTML = ' *Not a Valid Email'; return false; }
    else 
      {document.getElementById(messtarget).innerHTML = '&nbsp'; return true;}
  }


function mc_insertCommentForm(targetId, blogId) /*Version .5, Copyright 2009, Dethstarz.com, by siriuslydesign.com */
  {

    if(formNode = document.getElementById('commentform'))
      {
        
        formParent = document.getElementById('commentform').parentNode;
        removedNode = formParent.removeChild(formNode);
        delete removedNode;
      }


    // Form Element    
    var formElement = document.createElement("form"); //Creates Form Element
    formElement.setAttribute("id", "commentform");  //Sets Form Element Id
    formElement.setAttribute("action", "makecomment.php");  //Sets Form Element action
    formElement.setAttribute("method", "post");  //Sets Form Element method
    
    var paragraphElement = document.createElement("p"); //Create Paragraph Element

    // Label Element
    var labelElement = document.createElement("label");  // create Label Element
    var labelText = document.createTextNode("Comment:");  //Create Label Text
    labelElement.setAttribute("for", "body"); //Sets Label For attribute

    var br2Element = document.createElement("br"); // Create Line Break Element

    // Text Area Element
    var textAreaElement = document.createElement("textarea");  // Create Text Area Input
    textAreaElement.setAttribute("name", "body"); // sets text area name
    textAreaElement.setAttribute("cols", "65"); // sets text area columns
    textAreaElement.setAttribute("rows", "10");  //sets text area Rows

    var brElement = document.createElement("br"); //Create Line Break Element

    // Label Element
    var labelElement2 = document.createElement("label");  // create Label Element
    var labelText2 = document.createTextNode("Name:");  //Create Label Text
    labelElement2.setAttribute("for", "name"); //Sets Label For attribute

    //Name Field Element
    var nameElement = document.createElement("input");  // Create Text Area Input
    nameElement.setAttribute("type", "text"); // sets text area name
    nameElement.setAttribute("name", "poster"); // sets text area name
    nameElement.setAttribute("size", "32"); // sets text area name

    var brElement2 = document.createElement("br"); //Create Line Break Element



    // Button Element
    var submitElement = document.createElement("input"); // Creates Submit button Element
    submitElement.setAttribute("type", "submit"); // sets submit button type
    submitElement.setAttribute("value", "Submit");  // creates submit button value
    
    //blog id element (hidden)
    var blogIdElement = document.createElement("input"); // Creates type Element
    blogIdElement.setAttribute("name", "blogId"); // sets parent Id ID 
    blogIdElement.setAttribute("type", "hidden"); // sets type to hidden
    blogIdElement.setAttribute("value", blogId);  // sets value of type
    
    // Append Elements
    labelElement.appendChild(labelText);  //Appends Label Text to label
    paragraphElement.appendChild(labelElement); // append label to paragraph
    paragraphElement.appendChild(br2Element); // append line break to paragraph
    paragraphElement.appendChild(textAreaElement); // append text area to paragraph
    paragraphElement.appendChild(brElement); //appends line break to paragraph
    labelElement2.appendChild(labelText2);  //Appends Label Text to label
    paragraphElement.appendChild(labelElement2); // append label to paragraph
    paragraphElement.appendChild(nameElement); // append label to paragraph
    paragraphElement.appendChild(brElement2); //appends line break to paragraph
    paragraphElement.appendChild(submitElement); // append submit button to paragraph
    paragraphElement.appendChild(blogIdElement); // append comment parent id to paragraph   
    formElement.appendChild(paragraphElement); //appends paragraph to form   
    document.getElementById(targetId).appendChild(formElement); // appends form to target
    //window.location="blog.php#commentform"
  }

