/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function OuvrirPopup(page,nom,option) {
   window.open(page,nom,option);
}


function switchCat(SECTOR){
  new Ajax.Request('ajax/search.php', {
		method: 'post',
		parameters: {
    search: '1',
    what: 'categories',
		sector: SECTOR
		},
			onCreate: function(){
      },
			onComplete: function(transport) {
        
        if(transport.responseText != ''){   	// Response is ok
					
          $('cat').innerHTML = transport.responseText;
				}
      }
	});
}


function switchLocal(REGION){
  
  new Ajax.Request('ajax/search.php', {
		method: 'post',
		parameters: {
    search: '1',
    what: 'locals',
		region: REGION
		},
			onCreate: function(){
      },
			onComplete: function(transport) {

        if(transport.responseText != ''){   	// Response is ok

          $('loc').innerHTML = transport.responseText;
				} 
			}
	});
}


function printTableTraining(obj) {
content = document.getElementById(obj).innerHTML;
newwin = window.open('');
newwin.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\n',
'"http://www.w3.org/TR/html4/strict.dtd">\n',
'<html>\n',
'<head>\n',
'<title></title>\n',
'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n',
'<link href="http://vpm-dev/images/style.css" rel="stylesheet" type="text/css" />',
'<style> body {background-color: rgb(255,255,255); background-image: url(none); } </style>\n',

'<body>\n',
'<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" >\n',
' <tr>\n',
'   <td colspan="2" align="center">\n',
'   <img src="images/banner_print_1.jpg" width="100%"  height="100" >\n',
'   <td>\n',
' </tr>\n',
' <tr style="border:1px solid #d1d6d7;">\n',
'   <td colspan="2">\n',
'<table width="650" align="center"><tr><td>\n',
''+content+'\n',
'</td></tr></table>\n',
'    </td>\n',
'  </tr>\n',
'</table>\n',
'</body>\n',
'</html>');
newwin.print();
//newwin.close();
}

function searchSub(){

  if($('reg').value=='') $('reg').disable();
  if($('loc').value=='') $('loc').disable();
  if($('cat').value=='') $('cat').disable();
  
  return true;
}


Event.observe(window,'load',function(){
  

        document.getElementsByClassName('m1link').each(function(link){
              new Control.Modal(link,{
            		iframe: true,
                width: 550,
                height: 420
              });
            });

       document.getElementsByClassName('contacte').each(function(link){
       new Control.Modal(link,{
                    iframe: true,
                    width: 500,
                    height: 410
              });
            });

});

/*
function abrir_modal(valor, element_id ){
	$(element_id).href=valor;
	//alert($(row_id).href);

	var m = new Control.Modal(element_id,{
            iframe: true,
            width: 800,
						height: 620
					});
	m.open();
}
  */
