// browser check
var versionNum = navigator.appVersion.substring(0,1);
var OKnetscape = navigator.appName.indexOf( "Microsoft" ) != -1 ? false : true;
var fullVersion = navigator.appVersion.substring(2,3);
OKnetscape ? fullVersion=fullVersion : fullVersion=1;


// show affinites
function affinites(file) {
	window.open(file,'affinites','resizable=no,width=569,height=460,toolbar=no,scrollbars=no')}

// Ads Feature!!
function infobox() {
    var w;
    (parseInt(versionNum)<4 ) ? w=0 : w=screen.width;
    if (w==800) { 
        infobox=window.open("http://www.acheter-pas-cher.com/code-promo/default.htm",'infobox','resizable=yes,Width=680,Height=480,screenX=100,screenY=100,toolbar=yes,scrollbars=yes,location=yes');
    } 
    if (w>800) { 
		infobox=window.open("http://www.acheter-pas-cher.com/promo-voyages/sejours-thalasso.htm",'infobox','resizable=yes,Width=680,Height=480,screenX=185,screenY=185,toolbar=yes,scrollbars=yes,location=yes');
    } 
    if (w<800) { 
      infobox=window.open("http://www.acheter-pas-cher.com/code-promo/default.htm",'infobox','resizable=yes,Width=538,Height=395,screenX=0,screenY=0,toolbar=no,scrollbars=yes,location=yes');
    }
}	
		
// Open new link

function OpenLink(file) {
				window.open(file,'lien','resizable=yes,width=250,height=250,toolbar=no,scrollbars=no')
} 

// prepare netscapes event handling
function init() {
	if(OKnetscape && parseInt(versionNum) >= 4) {
	window.captureEvents(Event.RESIZE);
	window.onResize = resizeHandler;
	origWidth = innerWidth;
    origHeight = innerHeight;
	}
}

// reload page after resize	
function resizeHandler() {
        if (OKnetscape) {
	        if (innerWidth != origWidth || innerHeight != origHeight) {
	        	origWidth = innerWidth;
	        	origHeight = innerHeight;
	        	top.location.reload();
	        }       
        } else {
        	top.location.reload();
        }
}

// display status message
function setMsg(msg) {
        window.status = msg;
        return true;
}

// 3.x or 4.x document call
function doc(){
	if (OKnetscape && (parseInt(versionNum) > 3) && (parseInt(fullVersion)>0))

			return  window.document;
	else 
			return window.document;
}

function xForm(formNum){
	  return doc().forms[formNum];
 }

function docNew(){

	if (OKnetscape && (parseInt(versionNum) > 3) && (parseInt(fullVersion)>0))

			return  window.document.alignDiv.document;
	else 
			return window.document;
}

function xFormNew(formNum){
	  return docNew().forms[formNum];
 }
 


// show newsletterabo sucess or failure

function NewsletterSubmit(nase){
    var versionNum = navigator.appVersion.substring(0,1);
		var country
		var todo
		var email
		
		country=document.form1.country.value
		todo=document.form1.todo.value
		email=document.form1.email.value

		var url = "http://www.shop8.com/nouvelles/newsletterpopup.asp?country=" + country + "&todo=" + todo + "&email=" + email;
		
		if (parseInt(versionNum) > 3){
				window.open(url,'newsletter','resizable=no,width=300,height=170,toolbar=no,scrollbars=no,location=no')}
        else {
        window.open(url,'newsletter','resizable=no,width=330,height=180,toolbar=no,scrollbars=no,location=no')}

}



// show newsletterabo sucess or failure

function NewsletterStop(nase){
    var versionNum = navigator.appVersion.substring(0,1);
		var country
		var todo
		var email
		
		country=document.form1.country.value
		todo=document.form1.todo.value
		email=document.form1.email.value

		var url = "http://www.shop8.com/nouvelles/unsubscribe.asp?country=" + country + "&todo=" + todo + "&email=" + email;
		
		if (parseInt(versionNum) > 3){
				window.open(url,'newsletter','resizable=no,width=300,height=170,toolbar=no,scrollbars=no,location=no')}
        else {
        window.open(url,'newsletter','resizable=no,width=330,height=180,toolbar=no,scrollbars=no,location=no')}

}

// evaluation popup
function valeur(file) {
	window.open(file,'valeur','resizable=no,width=568,height=460,toolbar=no,scrollbars=no')}	
	


// show Carte
function carte(file) {
	window.open(file,'carte','resizable=no,width=403,height=550,toolbar=no,scrollbars=no')}	
	
// tell a friend popup
function friend(file) {
	window.open(file,'friend','resizable=no,width=400,height=450,toolbar=no,scrollbars=no')}	
	
	
//std document.form[formNum] check for isEmpty 
errorString = "";
function validateForm(formNum, formSubmit) {
	formError = false;
	for (i=0; i<xForm(formNum).elements.length; i++) {
		if(xForm(formNum).elements[i].type == "text" && xForm(formNum).elements[i].value == "") {errorString = "une petite fute s'est incrustee.\nEssayer encore une fois!\n"; formError = true;}
	}
	formError ? alert(errorString) : xForm(formSubmit).submit();
}



 
// test form values for newsletter submission on homepage
function testSubmit() {
	return !doc().form1.todo.value.length==0;
}

// submit newsletter values
function sendSubmission(s) {
	doc().form1.todo.value=s;
	doc().form1.submit();
}

// show opt-in
function launch() {
	if (parseInt(versionNum) > 3){
	window.open('/nouvelles/optin.asp','jenveux','resizable=no,width=400,height=520,toolbar=no,scrollbars=no')}
	else {
	window.open('/nouvelles/optin.asp','jenveux','resizable=no,width=420,height=500,toolbar=no,scrollbars=no')}  
}

function onloadPopup(popupURL){
        var versionNum = navigator.appVersion.substring(0,1);

		url = popupURL
		
		if (parseInt(versionNum) > 3){
		careWin = window.open(url,'logonWin','resizable=no,width=300,height=170,toolbar=no,scrollbars=no,location=no')}
        else {
        careWin = window.open(url,'logonWin','resizable=no,width=330,height=180,toolbar=no,scrollbars=no,location=no')}  
}
//verifier adresse email
function IsValidEmail(memail) {
	
	
		if ( (meMail.indexOf("@") == -1) ||
		 (meMail.indexOf(".") == -1) ||
		 (meMail.length < 5) ){
			alert("Veuillez vérifier votre adresse email!");			
			return;
		}

// ok....
	Else
	return 1;

}
//publicite
function blicite()
{
				window.open('/nouvelles/pub.asp','fenetre','resizable=no,width=250,height=250,toolbar=no,screenX=500,screenY=300,scrollbars=no,location=no')}