var msg="MNS Auto | Québec, Montreal | Vente d'autos usagées";



function ScrollTitle() {



    document.title=msg;

}



ScrollTitle();



function popUp(URL) {



	day = new Date();

	id = day.getTime();

	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=600');");



}



function popUp2(URL) {



	day = new Date();

	id = day.getTime();

	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=845,height=638');");

}



function popUp3(URL) {



	day = new Date();

	id = day.getTime();

	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300');");

}



var winheight=100

var winsize=100

var x=5



function openwindow(thelocation){



	temploc=thelocation



	if (!(window.resizeTo&&document.all)&&!(window.resizeTo&&document.getElementById)){



		window.open(thelocation)

		return

	}



	win2=window.open("","","scrollbars")

	win2.moveTo(0,0)

	win2.resizeTo(100,100)

	go2()

}



function go2(){



	if (winheight>=screen.availHeight-3)

		x=0

		win2.resizeBy(5,x)

		winheight+=5

		winsize+=5



		if (winsize>=screen.width-5){

			win2.location=temploc

			winheight=100

			winsize=100

			x=5

			return

		}

	setTimeout("go2()",50)

}



//JavaScript1.1

  browserOK = true;

  pics = new Array();

//

var objCount = 0;



function preload(name, first, second) {  



  if (browserOK) {     

    pics[objCount] = new Array(3);

    pics[objCount][0] = new Image();

    pics[objCount][0].src = first;

    pics[objCount][1] = new Image();

    pics[objCount][1].src = second;

    pics[objCount][2] = name;

    objCount++;

  }

}



function on(name){



  if (browserOK) {

     for (i = 0; i < objCount; i++) {

      if (document.images[pics[i][2]] != null)

        if (name != pics[i][2]) { 

          document.images[pics[i][2]].src = pics[i][0].src;

        } else {

           document.images[pics[i][2]].src = pics[i][1].src;

        }

    }

  }

}



function off(){



  if (browserOK) {

     for (i = 0; i < objCount; i++) {

      if (document.images[pics[i][2]] != null) 

        document.images[pics[i][2]].src = pics[i][0].src;

    }

  }

}



preload("index", "fi/butsmall6.gif", "fi/butbig6.gif")

preload("about", "fi/butsmall.gif", "fi/butbig.gif");

preload("achat", "fi/butsmall2.gif", "fi/butbig2.gif");

preload("location", "fi/butsmall3.gif", "fi/butbig3.gif");

preload("service", "fi/butsmall4.gif", "fi/butbig4.gif");

preload("contact", "fi/butsmall5.gif", "fi/butbig5.gif");

preload("financement", "fi/butsmall7.gif", "fi/butbig7.gif");

preload("english", "fi/butsmalleng.gif", "fi/butbigeng.gif");

preload("home", "ui/toplogo1.gif", "ui/toplogo2.gif");



function statbar(txt) {



   window.status = txt;

}



function formHandler(form){



	var URL = document.form.site.options[document.form.site.selectedIndex].value;

	window.location.href = URL;

}



var interval = 2.5; // delay between rotating images (in seconds)

var random_display = 1; // 0 = no, 1 = yes

interval *= 1000;

var image_index = 0;



image_list = new Array();



image_list[image_index++] = new imageItem("ui/car-1.jpg");

image_list[image_index++] = new imageItem("ui/car-7.jpg");

image_list[image_index++] = new imageItem("ui/car-3.jpg");

image_list[image_index++] = new imageItem("ui/car-4.jpg");

image_list[image_index++] = new imageItem("ui/car-5.jpg");

image_list[image_index++] = new imageItem("ui/car-6.jpg");

image_list[image_index++] = new imageItem("ui/car-2.jpg");



var number_of_image = image_list.length;



function imageItem(image_location) {



	this.image_item = new Image();

	this.image_item.src = image_location;

}



function get_ImageItemLocation(imageObj) {



	return(imageObj.image_item.src)

}



function generate(x, y) {



	var range = y - x + 1;

	return Math.floor(Math.random() * range) + x;

}



function getNextImage() {



	if (random_display) {

	image_index = generate(0, number_of_image-1);

	}else {

		image_index = (image_index+1) % number_of_image;

	}



	var new_image = get_ImageItemLocation(image_list[image_index]);

	return(new_image);

}



function rotateImage(place) {



	var new_image = getNextImage();

	document[place].src = new_image;

	var recur_call = "rotateImage('"+place+"')";

	setTimeout(recur_call, interval);

}



function loadDate()

{

   var theday=new Date();

   //var weekday=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");

   var monthname=new Array("Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre");

   

  

   document.write("<span class='datetxt'>");

   document.write(theday.getDate() + " ");

   document.write(monthname[theday.getMonth()] + ", ");

   document.write(theday.getFullYear()+"</span>");

}

var tempId = '0';
function showBiggerPic(id){
  if(id != tempId){
    document.getElementById('showBiggerPic_' + id).style.display = 'block';
    closeBiggerPic();
  }
  tempId = id;
}

function closeBiggerPic(){
  document.getElementById('showBiggerPic_' + tempId).style.display = 'none';
  tempId = '0';
  return false;
}
