


var baseUrl="/php/callMod.php";
//-------------------
function jump(astrDesc)
{
	window.location = astrDesc;
}


function getVideo(article,numero,div_num,backrub)
{
		new Ajax.Request(baseUrl, {
  		method: 'get',
  		parameters: {mod:'rendering', req:'getOneVideoHome', id_article: article, num_video: numero,back:backrub},
    	onSuccess: function(transport){
      		var response = transport.responseText;
      		$(div_num).update(response);     			
    		},
    	onFailure: function(){ alert('Internal serveur err-404-405and co')}	
  		});		
	
	
}
function getMyVideo(article,numero,div_num)
{
		new Ajax.Request(baseUrl, {
  		method: 'get',
  		parameters: {mod:'rendering', req:'getMyVideo', id_article: article, num_video: numero},
    	onSuccess: function(transport){
      		var response = transport.responseText;
      		$(div_num).update(response);     			
    		},
    	onFailure: function(){ alert('Internal serveur err-404-405and co')}	
  		});		
	
	
}


function doNewsletter()
{
		var anEmail = 	 $('nwFld').value;
		new Ajax.Request(baseUrl, {
  		method: 'get',
  		parameters: {mod:'basics', req:'addNewsletter', email: anEmail},
    	onSuccess: function(transport){
      		var response = transport.responseText;
      		if (response=="OK")
      			{ 			    
      			alert("Votre inscription à la newsletter est validé !");
      			$('nwFld').value="Votre E-MAIL"; 			
      			}
      		else
      			alert(response);
    		},
    	onFailure: function(){ alert('Internal serveur err-404-405and co')}	
  		});		
}

function doContact()
{
	
	if ($('nom_fld').value == "")
		alert("Veuillez indiquer un nom.");
	else
	{
		if ($('coment_fld').value=="")
			alert("Veuillez indiquer un commentaire....");
		else
		{
			new Ajax.Request(baseUrl, {
	  		method: 'post',
	  		parameters: {mod:'basics', req:'doCommentaire', email: $('email_fld').value,
	  		nom : $('nom_fld').value, prenom : $('prenom_fld').value, commentaire : $('coment_fld').value , societe : $('sct_fld').value},
	    	onSuccess: function(transport){
	      		var response = transport.responseText;
	      		if (response=="OK")
	      			{ 			    
	      			alert("Votre commentaire a été transmis !");
	      			jump("/index.php");			
	      			}
	      		else
	      			alert(response);
	    		},
	    	onFailure: function(){ alert('Internal serveur err-404-405and co')}	
	  		});		
		}
	}
}



function doSendTo(article,num,back)
{
	if ($('nom_fld').value == "")
		alert("Veuillez indiquer un nom.");
	else
	{
		if ($('coment_fld').value=="")
			alert("Veuillez indiquer un commentaire....");
		else
		{
			new Ajax.Request(baseUrl, {
	  		method: 'post',
	  		parameters: {mod:'basics', req:'doRecommandation', email: $('email_fld').value,
	  		nom : $('nom_fld').value, prenom : $('prenom_fld').value, commentaire : $('coment_fld').value , societe : $('sct_fld').value, id_article:article , video:num ,rubToGo:back},
	    	onSuccess: function(transport){
	      		var response = transport.responseText;
	      		if (response=="OK")
	      			{ 			    
	      			alert("Votre recommandation à  a été transmise !");
	      			jump("/index.php?rub=12&subRub="+back);			
	      			}
	      		else
	      			alert(response);
	    		},
	    	onFailure: function(){ alert('Internal serveur err-404-405and co')}	
	  		});		
		}
	}	
}


function doLogin()
{
		var thelogin = 	 $('loginFld').value;
		var thepass = 	 $('passwFld').value;
		if(thelogin == "" || thepass=="")
			alert("Le login ou lepassword ne peuvent être vides");
		else
		{
			new Ajax.Request(baseUrl, {
	  		method: 'get',
	  		parameters: {mod:'basics', req:'login', login: thelogin, password:thepass},
	    	onSuccess: function(transport){
	      		var response = transport.responseText;
	      		if (response=="OK")
	      			{ 			    
	      			jump("/index.php?rub=home");			
	      			}
	      		else
	      			alert(response);
	    		},
	    	onFailure: function(){ alert('Internal serveur err-404-405and co')}	
	  		});		
		}
}

function deConnect()
{
			new Ajax.Request(baseUrl, {
	  		method: 'get',
	  		parameters: {mod:'basics', req:'deconnect'},
	    	onSuccess: function(transport){
	      	var response = transport.responseText;
	      	if (response=="OK")
	      			{ 			    
	      			jump("/index.php");			
	      			}
	      	else
	      		alert(response);
	    		},
	    	onFailure: function(){ alert('Internal serveur err-404-405and co')}	
	  		});		
		
}


function dl(fileToDL)
{
		$('dlIframe').src=baseUrl+"?mod=basics&req=dl&fichier="+fileToDL; 	
}

function openWindow(anchor, options) {
 
	var args = '';
 
	if (typeof(options) == 'undefined') { var options = new Object(); }
	if (typeof(options.name) == 'undefined') { options.name = 'win' + Math.round(Math.random()*100000); }
 
	if (typeof(options.height) != 'undefined' && typeof(options.fullscreen) == 'undefined') {
		args += "height=" + options.height + ",";
	}
 
	if (typeof(options.width) != 'undefined' && typeof(options.fullscreen) == 'undefined') {
		args += "width=" + options.width + ",";
	}
 
	if (typeof(options.fullscreen) != 'undefined') {
		args += "width=" + screen.availWidth + ",";
		args += "height=" + screen.availHeight + ",";
	}
 
	if (typeof(options.center) == 'undefined') {
		options.x = 0;
		options.y = 0;
		args += "screenx=" + options.x + ",";
		args += "screeny=" + options.y + ",";
		args += "left=" + options.x + ",";
		args += "top=" + options.y + ",";
	}
 
	if (typeof(options.center) != 'undefined' && typeof(options.fullscreen) == 'undefined') {
		options.y=Math.floor((screen.availHeight-(options.height || screen.height))/2)-(screen.height-screen.availHeight);
		options.x=Math.floor((screen.availWidth-(options.width || screen.width))/2)-(screen.width-screen.availWidth);
		args += "screenx=" + options.x + ",";
		args += "screeny=" + options.y + ",";
		args += "left=" + options.x + ",";
		args += "top=" + options.y + ",";
	}
 
	if (typeof(options.scrollbars) != 'undefined') { args += "scrollbars=1,"; }
	if (typeof(options.menubar) != 'undefined') { args += "menubar=1,"; }
	if (typeof(options.locationbar) != 'undefined') { args += "location=1,"; }
	if (typeof(options.resizable) != 'undefined') { args += "resizable=1,"; }
 
	var win = window.open(anchor, options.name, args);
	return false;
 
}