//$(document).ready(function(){

//$("#report").submit(function() {

function FormSubmit(){



var category, video, mediaName, reason, details, url;

category=document.report.category.value;

category=category.split(" ");

category=category.join("__");



videoID=document.report.videoID.value;



video=$('#video').val();

video=video.split(" ");

video=video.join("__");



mediaName=$('#mediaName').val();

mediaName=mediaName.split(" ");

mediaName=mediaName.join("__");



reason=document.report.reason.value;

reason=reason.split(" ");

reason=reason.join("__");



details=document.report.details.value;

details=details.split(" ");

details=details.join("__");

url=document.report.url.value; 

//alert(url);



//$("#report").load("http://www.tamilpeek.com/reportSubmit.php?category="+category+"&videoID="+videoID+"&video="+video+"&mediaName="+mediaName+"&reason="+reason+"&details="+details);

  var xmlHttp;

  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
                   var myString = new String(xmlHttp.responseText);
                   var myarray = myString.split('-');
                   //alert(myString);
                   document.location.href='http://www.tamilpeek.com'+url;
        }
      } 
    //alert("http://www.tamilpeek.com/reportSubmit.php?category="+category+"&videoID="+videoID+"&video="+video+"&mediaName="+mediaName+"&reason="+reason+"&details="+details); 
    xmlHttp.open("GET", "http://www.tamilpeek.com/reportSubmit.php?category="+category+"&videoID="+videoID+"&video="+video+"&mediaName="+mediaName+"&reason="+reason+"&details="+details, true);
    xmlHttp.send(null);
//});

//});

}



function simplemodal_close (dialog) {

    dialog.data.fadeOut('fast', function () {

        dialog.container.hide('fast', function () {

            dialog.overlay.slideUp('fast', function () {

                $.modal.close();

            });

        });

    });

}





function validate()

{

  if (document.report.reason.value == "" )

  {

    alert("Reason is a required field");

    document.report.reason.focus()

    return false;

  }

    

  if (document.report.details.value == "" )

  {

    alert("Details is a required field");

    document.report.details.focus()

    return false;

  }

  //if(document.report.reason.value != "" && document.report.details.value != "") FormSubmit();

}


