function view_message(date, to, from, name, phone, ip, message)
{ var win;
  win = window.open('', '', 'dependent=yes, height=300, width=300, resizable=yes, location=no, menubar=no, scrollbars=no, status=no, titlebar=no, toolbar=no');
  win.document.write("<b>Date: </b>"+date+"<br />");
  win.document.write("<b>To: </b>"+to+"<br />");
  win.document.write("<b>Customer Name: </b>"+name+"<br />");
  win.document.write("<b>Customer Email: </b>"+from+"<br />");
  win.document.write("<b>Customer Phone: </b>"+phone+"<br />");
  win.document.write("<b>Customer Ip: </b>"+ip+"<br /><br />");
  win.document.write(message);
  win.document.write("<br /><br /><div align='right'>");
  win.document.write("<input type=button value='close' onclick='window.close()'>");
  win.document.write("</div>");
}

function call_listen(call_id)
{ var win;
  win=window.open("get_phone.php?call_id="+call_id,"ViewMessage","dependent=yes,height=30,width=300,location=no,menubar=no,resizeable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
}

function trim(str)
{ var start_pos=0;
  var end_pos=str.length;

  for(start_pos=0;start_pos<end_pos;start_pos++)
    if(str.charAt(start_pos)!=' ') break;


  for(end_pos=end_pos-1;end_pos>0;end_pos--)
    if(str.charAt(end_pos)!=' ') break;

  if((start_pos==str.length)&&(end_pos==0)) return "";

  return str.substring(start_pos, end_pos+1);
}

function validate_email(email)
{
  if(email == "") return true;
  var reg = new RegExp("[0-9a-z_]+@[0-9a-z_^.]+\\.[a-z]", 'i');
  if (!reg.test(email)) return false;
  return true;
}

function validate_form(form)
{ var mess="";
  if(!trim(form.name.value)) mess+="The Name is empty.\n";
  if(!validate_email(trim(form.email.value))) mess+="The E-Mail is not valid.\n";
  if(!trim(form.message.value)) mess+="The Message is empty.\n";
  if(mess=='') return true;
  alert(mess);
  return false;
}



function showplayer(filename) {
    var fo = new SWFObject("/inc/flowplayer/FlowPlayer.swf", "FlowPlayer", "50%", "200", "7", "#ffffff", true);
    // need this next line for local testing, it's optional if your swf is on the same domain as your html page
    fo.addParam("allowScriptAccess", "always");
    fo.addVariable("config", "{ playList: [ {overlayId: 'play' }, { url: '"+filename+"' } ], autoBuffering: true, initialScale: 'scale', showPlayListButtons: false}");
    fo.write("flowplayerholder");
}