function chat() {

   w=700;
   h=500;
   
   wleft = (screen.width - w) / 2;
    wtop = (screen.height - h) / 2;

  // IE5 and other old browsers might allow a window that is
  // partially offscreen or wider than the screen. Fix that.
  // (Newer browsers fix this for us, but let's be thorough.)

  if (wleft < 0) {
    w = screen.width;
    wleft = 0;
  }

  if (wtop < 0) {
    h = screen.height;
    wtop = 0;
  } 

 
   var chatwin=window.open("chat/index.php","","resizable=yes,width="+w+",height="+h+", top="+wtop+", left="+wleft);
   
   // Just in case width and height are ignored
    newwin.resizeTo(w, h);

   // Just in case left and top are ignored
   newwin.moveTo(wleft, wtop);
   newwin.focus();
  

}


function wmv(url,w,h) {

   
    wleft = (screen.width - w) / 2;
    wtop = (screen.height - h) / 2;

  // IE5 and other old browsers might allow a window that is
  // partially offscreen or wider than the screen. Fix that.
  // (Newer browsers fix this for us, but let's be thorough.)

  if (wleft < 0) {
    w = screen.width;
    wleft = 0;
  }

  if (wtop < 0) {
    h = screen.height;
    wtop = 0;
  } 

 
   var newwin=window.open("","","resizable=yes,width="+w+",height="+h+", top="+wtop+", left="+wleft);
   
   // Control bar height = 46 pixels
   // Status bar height = 26 pixels

   newwin.document.writeln("<html>");
   newwin.document.writeln("<title>Kiteforum Brasil</title>");
   newwin.document.writeln("<body bgcolor='white' marginwidth='0' marginheight='0' topmargin='0' leftmargin='0'>");
   newwin.document.writeln("<OBJECT ID='MediaPlayer' WIDTH="+w+" HEIGHT="+(h-72)+" CLASSID='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' STANDBY='Loading Windows Media Player components...' TYPE='application/x-oleobject'>");
   newwin.document.writeln("<PARAM NAME='FileName' VALUE="+url+">");
   newwin.document.writeln("<PARAM name='ShowControls' VALUE='true'>");
   newwin.document.writeln("<param name='ShowStatusBar' value='true'>");
   newwin.document.writeln("<PARAM name='ShowDisplay' VALUE='false'>");
   newwin.document.writeln("<PARAM name='autostart' VALUE='true'>");
   newwin.document.writeln("<PARAM name='stretchToFit' VALUE='true'>");

   newwin.document.writeln("<EMBED TYPE='application/x-mplayer2' SRC="+url+" NAME='MediaPlayer' WIDTH="+w+" HEIGHT="+(h-72)+" ShowControls='1' ShowStatusBar='1' ShowDisplay='0' autostart='1' stretchToFit='1'> </EMBED>");
   newwin.document.writeln("</OBJECT>");
   
   newwin.document.writeln("</body>");
   newwin.document.writeln("</html>");

   // Just in case width and height are ignored
    newwin.resizeTo(w, h);

   // Just in case left and top are ignored
   newwin.moveTo(wleft, wtop);
   newwin.focus();


}

function popupPrev(form) {

 
 var cidade = form.selprevisao.options[form.selprevisao.selectedIndex].value;

 if (form.source[0].checked)
    windFinder(cidade);
 else if (form.source[1].checked)
    buoyWeather(cidade);
 else if (form.source[2].checked)
    surfGuru(cidade);
 else if (form.source[3].checked)
    cptec(cidade);

 
  
}

function windFinder(cidade) {

 if (cidade=="maceio") 
 
    win=window.open("previsoes/windfinder/wfmaceio.html","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
   
 else if (cidade=="recife")
    win=window.open("previsoes/windfinder/wfrecife.html","newwin","scrollbars=yes,resizable=yes,height=600,width=800");

 else if (cidade=="jpessoa")
    win=window.open("previsoes/windfinder/wfjoaopessoa.html","newwin","scrollbars=yes,resizable=yes,height=600,width=800");

 else if (cidade=="rnlitnorte")
    win=window.open("previsoes/windfinder/wfrnlitnorte.html","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
 
 else if (cidade=="rnlitsul")
    win=window.open("previsoes/windfinder/wfrnlitsul.html","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
  
 else if (cidade=="salvador")
    win=window.open("previsoes/windfinder/wfsalvador.html","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
  
 else if (cidade=="aracaju")
    win=window.open("previsoes/windfinder/wfaracaju.html","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
	
 else if (cidade=="celitcentral")
    win=window.open("previsoes/windfinder/wfcecentral.html","newwin","scrollbars=yes,resizable=yes,height=600,width=800");

 else if (cidade=="celitnorte")
    win=window.open("previsoes/windfinder/wfcenorte.html","newwin","scrollbars=yes,resizable=yes,height=600,width=800");

 else if (cidade=="piaui")
    win=window.open("previsoes/windfinder/wfpiaui.html","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
		


}

function buoyWeather(cidade) {
    
    if (cidade=="maceio") 
 
      win=window.open(
      "http://www.buoyweather.com/wxnav6.jsp?region=BN&program=nww3BW1&grb=nww3&latitude=-10.0&longitude=-35.0&zone=-3&units=e","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
     
    else if (cidade=="recife")
      win=window.open(
     "http://www.buoyweather.com/wxnav6.jsp?region=BN&program=nww3BW1&grb=nww3&latitude=-8.0&longitude=-33.75&zone=-3&units=e","newwin","scrollbars=yes,resizable=yes,height=600,width=800");

    else if (cidade=="jpessoa")
      win=window.open(
     "http://www.buoyweather.com/wxnav6.jsp?region=BN&program=nww3BW1&grb=nww3&latitude=-7.0&longitude=-33.75&zone=-3&units=e","newwin","scrollbars=yes,resizable=yes,height=600,width=800");

    else if (cidade=="rnlitnorte")
      win=window.open(
      "http://www.buoyweather.com/wxnav6.jsp?region=BN&program=nww3BW1&grb=nww3&latitude=-5.0&longitude=-35.0&zone=-3&units=e","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
 
    else if (cidade=="rnlitsul")
     win=window.open(
     "http://www.buoyweather.com/wxnav6.jsp?region=BN&program=nww3BW1&grb=nww3&latitude=-6.0&longitude=-33.75&zone=-3&units=e","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
  
    else if (cidade=="salvador")
     win=window.open(
    "http://www.buoyweather.com/wxnav6.jsp?region=BN&program=nww3BW1&grb=nww3&latitude=-13.0&longitude=-37.5&zone=-3&units=e","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
  
    else if (cidade=="aracaju")
     win=window.open(
    "http://www.buoyweather.com/wxnav6.jsp?region=BN&program=nww3BW1&grb=nww3&latitude=-12.0&longitude=-36.25&zone=-3&units=e","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
	
 else if (cidade=="celitcentral")
    win=window.open(
    "http://www.buoyweather.com/wxnav6.jsp?region=BN&program=nww3BW1&grb=nww3&latitude=-3.0&longitude=-37.5&zone=-3&units=e","newwin","scrollbars=yes,resizable=yes,height=600,width=800");

 else if (cidade=="celitnorte")
    win=window.open(
    "http://www.buoyweather.com/wxnav6.jsp?region=BN&program=nww3BW1&grb=nww3&latitude=-2.0&longitude=-40.0&zone=-3&units=e","newwin","scrollbars=yes,resizable=yes,height=600,width=800");

 else if (cidade=="piaui")
    win=window.open(
    "http://www.buoyweather.com/wxnav6.jsp?region=BN&program=nww3BW1&grb=nww3&latitude=-2.0&longitude=-41.25&zone=-3&units=e","newwin","scrollbars=yes,resizable=yes,height=600,width=800");

}

function surfGuru(cidade) {

   if (cidade=="maceio") 
 
      win=window.open(
      "http://www.surfguru.com.br/previsao/default.asp?lit=27","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
     
    else if (cidade=="recife")
      win=window.open(
     "http://www.surfguru.com.br/previsao/default.asp?lit=28","newwin","scrollbars=yes,resizable=yes,height=600,width=800");

    else if (cidade=="jpessoa")
      win=window.open(
     "http://www.surfguru.com.br/previsao/default.asp?lit=30","newwin","scrollbars=yes,resizable=yes,height=600,width=800");

    else if (cidade=="rnlitnorte")
      win=window.open(
      "http://www.surfguru.com.br/previsao/default.asp?lit=33","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
 
    else if (cidade=="rnlitsul")
     win=window.open(
     "http://www.surfguru.com.br/previsao/default.asp?lit=31","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
  
    else if (cidade=="salvador")
     win=window.open(
    "http://www.surfguru.com.br/previsao/default.asp?lit=24","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
  
    else if (cidade=="aracaju")
     win=window.open(
    "http://www.surfguru.com.br/previsao/default.asp?lit=26","newwin","scrollbars=yes,resizable=yes,height=600,width=800");
	
 else if (cidade=="celitcentral")
    win=window.open(
    "http://www.surfguru.com.br/previsao/default.asp?lit=35","newwin","scrollbars=yes,resizable=yes,height=600,width=800");

 else if (cidade=="celitnorte")
    win=window.open(
    "http://www.surfguru.com.br/previsao/default.asp?lit=36","newwin","scrollbars=yes,resizable=yes,height=600,width=800");

 else if (cidade=="piaui")
    win=window.open(
    "http://www.surfguru.com.br/previsao/default.asp?lit=37","newwin","scrollbars=yes,resizable=yes,height=600,width=800");



}

function cptec(cidade) {

    if (cidade=="maceio") 
 
      win=window.open("previsoes/cptec/cpmaceio.html","newwin","scrollbars=yes,resizable=yes,height=600,width=650");

   else if (cidade=="celitcentral")
    win=window.open("previsoes/cptec/cpcelitcentral.html","newwin","scrollbars=yes,resizable=yes,height=600,width=650");

   else if (cidade=="jpessoa")
    win=window.open("previsoes/cptec/cpjpessoa.html","newwin","scrollbars=yes,resizable=yes,height=600,width=650");

   else if (cidade=="recife")
     win=window.open("previsoes/cptec/cprecife.html","newwin","scrollbars=yes,resizable=yes,height=600,width=650");

   else if (cidade=="piaui")
    win=window.open(
    "http://tempo.cptec.inpe.br:8080/prevnum/ProcessMeteo?modelo=Eta20&ponto=Parnaíba&lat=-2.9047&lon=-41.7767","newwin","scrollbars=yes,resizable=yes,height=530,width=710");


   else if (cidade=="rnlitnorte")
    win=window.open(
    "http://tempo.cptec.inpe.br:8080/prevnum/ProcessMeteo?modelo=Eta20&ponto=Macau&lat=-5.1150&lon=-36.6344","newwin","scrollbars=yes,resizable=yes,height=530,width=710");

    else if (cidade=="rnlitsul")
     win=window.open("previsoes/cptec/cpnatal.html","newwin","scrollbars=yes,resizable=yes,height=600,width=650");
  
  
    else if (cidade=="salvador")
     win=window.open("previsoes/cptec/cpsalvador.html","newwin","scrollbars=yes,resizable=yes,height=600,width=650");
  
    else if (cidade=="aracaju")
     win=window.open("previsoes/cptec/cparacaju.html","newwin","scrollbars=yes,resizable=yes,height=600,width=650");
   

}
