function writetoolbar(writelaunch){
      document.write("");

}

//alert((Math.round((Math.random()*4)+1)) + "," + (Math.round((Math.random()*4)+1)) + "," +(Math.round((Math.random()*4)+1)) + "," +(Math.round((Math.random()*4)+1)) + "," +(Math.round((Math.random()*4)+1)) + "," +(Math.round((Math.random()*4)+1)) + "," +(Math.round((Math.random()*4)+1)) + "," +(Math.round((Math.random()*4)+1)) + "," +(Math.round((Math.random()*4)+1)) + "," +(Math.round((Math.random()*4)+1)) + "," +(Math.round((Math.random()*4)+1)) + "," +(Math.round((Math.random()*4)+1)) + "," +(Math.round((Math.random()*4)+1)));

function ow (){
  var vrnd = (Math.round((Math.random()*4)+1));
  if (vrnd > 0 ){
     //alert("win 1");
     myWindow = window.open("/city/cny/scroll9a.php?rnd=" + new Date().getTime(), "citywin", 'maximize=1,location=0,status=0,scrollbars=0'); 
     myWindow.moveTo(0,0)
     myWindow.resizeTo(screen.width,screen.height);
   }else{
     //alert("win 2");
     myWindow = window.open("http://www.citypixel.info/city/cny/scroll9a.php?rnd=" + new Date().getTime(), "tinyWindow" + new Date().getTime(), 'top=0,left=0,width=' + screen.width + ',height=' + screen.height + ',maximize=1,location=0,status=0,scrollbars=0'); 
   }
}

function os(){
   myWindow = window.open("/useradmin/createuserdialog.php", "tinyWindow" + new Date().getTime(), 'top=0,left=0,width=700,height=800,maximize=1,location=0,status=0,scrollbars=yes'); 
}

function dl (){
  var vrnd = (Math.round((Math.random()*4)+1));
  if (vrnd > 0 ){
     //alert("win 1");
     myWindow = window.open("/useradmin/logindialog.php?forward=true&rnd=" + new Date().getTime(), "citywin", 'maximize=1,location=0,status=0,scrollbars=0'); 
     myWindow.moveTo(0,0)
     myWindow.resizeTo(screen.width,screen.height);
   }
}


function writebottom(){
      document.write("");

}


function formsubmit(){
  //alert("formsubmit");
  document.uform.firstname.value = RemoveBad(document.uform.firstname.value);
  document.uform.password.value = RemoveBad(document.uform.password.value);

  var isvalid = true;

    if (isvalid){
      hurl = document.uform.firstname.value;
      hurl = trim(hurl);
      if (hurl.length == 0){
        isvalid=false;
        alert("Please enter your firstname.");
      }
    }


    if (isvalid){
      hurl = document.uform.email.value;
      hurl = trim(hurl);
      if (hurl.length == 0){
        isvalid=false;
        alert("Please enter a valid email address.");
      }
    }

    if (isvalid){
      hurl = document.uform.email.value;
      hurl = trim(hurl);
      if (hurl.length > 1 && (hurl.indexOf(".") == -1 || hurl.indexOf("@") == -1)){
        isvalid=false;
        alert("Please enter a valid email address.\n '" + hurl + "' does not appear to be entered correctly.");
      }
    }

    if (isvalid){
      hurl = document.uform.email.value;
      hurl = trim(hurl);
      if (hurl.length > 1 && (hurl.indexOf("#") > -1 || hurl.indexOf("%") > -1 || hurl.indexOf("$") > -1 || hurl.indexOf("'") > -1 || hurl.indexOf("\"") > -1 || hurl.indexOf("<") > -1 || hurl.indexOf(">") > -1 )){
        isvalid=false;
        alert("Please enter a valid email.\n '" + hurl + "' cannot contain ',\",<,>,#,$ or %.");
      }
    }


    if (isvalid){
      hurl = document.uform.password.value;
      //alert("pwd" + hurl);
      hurl = trim(hurl);
      if (hurl.length > 1 && (hurl.indexOf("#") > -1 || hurl.indexOf("%") > -1 || hurl.indexOf("$") > -1 || hurl.indexOf("'") > -1 || hurl.indexOf("\"") > -1 || hurl.indexOf("<") > -1 || hurl.indexOf(">") > -1 )){
        isvalid=false;
        alert("Please enter a valid password.\n '" + hurl + "' cannot contain ',\",<,>,#,$ or %.");
      }
    }

    if (isvalid){

      myWindow = window.open("", "fwdwindow", 'top=0,left=0,width=' + screen.width + ',height=' + screen.height  + ',maximize=yes,resizable=yes,location=0,status=0,scrollbars=0'); 
      document.uform.target="fwdwindow";
      
      document.uform.submit();
      //alert("SUBMIT");
    }
}

function RemoveBad(strTemp) {
    //allow <br> in message
    strTemp = strTemp.replace(/'/g, "`");
    strTemp = strTemp.replace(/<br>/g, "HTMLNEWLINE");

    strTemp = strTemp.replace(/\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-/g,"");
    //remove permutations of 'script'
    strTemp = strTemp.replace(/script/g, "");
    strTemp = strTemp.replace(/citypixel./g, "");
    strTemp = strTemp.replace(/\n/g, "<br>");
    strTemp = strTemp.replace(/HTMLNEWLINE/g, "<br>");


    return strTemp;
}

 function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}



