﻿function navigateur()
{
	var ua = navigator.userAgent;
	var reg_ie7 = new RegExp('.*msie 7.*','i');
	var reg_ie6 = new RegExp('.*msie 6.*','i');
	var reg_ie5 = new RegExp('.*msie 5.*','i');
	var reg_ie4 = new RegExp('.*msie 4.*','i');
	var reg_ff = new RegExp('.*firefox.*','i');
	if(navigator.appName == 'Microsoft Internet Explorer' && reg_ie7.exec(ua) != null)
	{
		return 'ie7';
	}
	else if(navigator.appName == 'Microsoft Internet Explorer' && reg_ie6.exec(ua) != null)
	{
		return 'ie6';
	}
	else if(navigator.appName == 'Microsoft Internet Explorer' && reg_ie5.exec(ua) != null)
	{
		return 'ie5';
	}
	else if(navigator.appName == 'Microsoft Internet Explorer' && reg_ie4.exec(ua) != null)
	{
		return 'ie4';
	}
	else if(navigator.appName == 'Netscape' && reg_ff.exec(ua) != null)
	{
		return 'ff';
	}
	else
	{
		return null;
	}
}


function moteur()
{
	if(navigateur() == 'ie7' || navigateur() == 'ff')
	{
		window.external.AddSearchProvider('http://www.htp2p.com/search.xml');
	}
	else
	{
	window.alert('Cette fonction nest pas compatible avec votre navigateur');
	}
}

function favoris()
{
	if(navigateur() == 'ie7' || navigateur() == 'ie6' || navigateur() == 'ie5' || navigateur() == 'ie4')
	{
		window.external.AddFavorite(document.location.href,document.title);
	}
	else if(navigateur() == 'ff')
	{
		window.sidebar.addPanel(document.title,document.location.href,'');
	}
}

function PopupImage(img) {
	titre="Photo";
	w=open("",'image','width=400,height=400,toolbar=no,scrollbars=no,resizable=yes');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+30); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src='"+img+"' border=0>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

function envoyerpage()
{
	window.open('/EnvoyerLaPage.aspx?url='+document.location.href, 'EnvoyerPage','toolbar=no,status=no,directories=no,menubar=no,location=no,scrollbars=no,resizable=yes,width=400,height=500');

			
}

function Notice(ancre)
{
	window.open('/Notice.aspx#'+ancre , 'EnvoyerPage','toolbar=no,status=no,directories=no,menubar=no,location=no,scrollbars=yes,resizable=no,width=400,height=350');

			
}

function AddCDC(IdAr)
{
	window.open('/myHTP2P/CoupDeCoeurAdd.aspx?Id='+IdAr  , 'AjoutercoupDecoeur','toolbar=no,status=no,directories=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=500,height=180');

			
}

function Evaluation(FLId)
{
	window.open('/myHTP2P/Evaluation.aspx?FLId='+FLId , 'Evaluation','toolbar=no,status=no,directories=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=500,height=450');

			
}

function VideoCommenVendre()
{
	window.open('/Aide/Vente/Comment_Vendre.aspx' , 'CommentVendre','toolbar=no,status=no,directories=no,menubar=no,location=no,scrollbars=no,resizable=yes,width=825,height=640');
}

function VideoCommenAcheter()
{
	window.open('/Aide/Achat/Comment_Acheter.aspx' , 'CommentAcheter','toolbar=no,status=no,directories=no,menubar=no,location=no,scrollbars=no,resizable=yes,width=871,height=640');
}
function VideoCoupsDeCoeur()
{
	window.open('/Aide/Achat/Coups_de_Coeur.aspx' , 'CommentAcheter','toolbar=no,status=no,directories=no,menubar=no,location=no,scrollbars=no,resizable=yes,width=823,height=650');
}


function demarche(page) {
		window.open(page,'demarche','width=400,height=400,toolbar=false,scrollbars=false');	
}

function calculette(page) {
		window.open(page,'calculette','width=600,height=495,toolbar=false,scrollbars=false');	
}
function copy2Clipboard(obj)
	{
  	var textRange = document.body.createTextRange();
  	textRange.moveToElementText(obj);
  	textRange.execCommand("Copy");
	}
