// JavaScript Document

function setFormDate(direction,month,day,year){
	var form = document.searchForm;
		dayObj = eval('form.'+direction+'Day');
	/*	monthObj = eval('form.'+direction+'Month');
		yearObj = eval('form.'+direction+'Year');*/
		monthYearObj  = eval('form.'+direction+'MonthYear')
		//alert(day.length);
		for(x=0;x<dayObj.length;x++){
			if(dayObj.options[x].value == day){
				
				dayObj.selectedIndex=x;
			}
		}
	/*	for(x=0;x<monthObj.length;x++){
			if(monthObj.options[x].value == month){
				
				monthObj.selectedIndex=x;
			}
		}*/
		
		for(x=0;x<monthYearObj.length;x++){
		
			if(monthYearObj.options[x].value == year+"-"+month){
				
				monthYearObj.selectedIndex=x;
			}
			
	/*	for(x=0;x<yearObj.length;x++){
			if(yearObj.options[x].value == year){
				
				yearObj.selectedIndex=x;
			}*/
		}

}
function doSubmit(form){

	var objForm = eval('document.'+form);

	if(validateForm()){
		objForm.submit();	
	}
}

function validateSearchForm(obj){
	obj = document.searchForm ;
	check =true;
	if(obj.citySelect1.value==""){
		alert("Please choose a city");
		obj.focus();
		check= false;
	}
	
	if(check){
		obj.submit();
	}
	
}
var displayWin;
function popUp(url,width,height,sroll){

	var query="";
	var flag=0;
	if(sroll=="yes"){query=",resizable=yes,scrollbars=yes,outerHeight="+height+",outerWidth="+width;}
	
	offsetX = (screen.width - width)/2;
	if(offsetX<0){ offsetX = 10; }

	offsetY = (screen.height - height)/2;
	if(offsetY<0){ offsetY = 10; }

	if(displayWin != null){
		displayWin.close();
		displayWin = window.open(url,"win","status=no,width="+width+",height="+height+",top="+offsetY+",left="+offsetX+query);
	}else{
		displayWin = window.open(url,"win2","status=no,width="+width+",height="+height+",top="+offsetY+",left="+offsetX+query);

	}

} 

function popUpIndendent(url,width,height,sroll){
	
	ran = Math.round(Math.random(1,10)*100)
	var newName = "new"+ran;
	var query="";
	if(sroll=="yes"){query=",resizable=yes,scrollbars=yes";}
	
	
		displayWin = window.open(url,newName,"status=yes,width="+width+",height="+height+query);
	
		
	
	displayWin.moveTo(200,175);
} 

/*************************INNER HTML PORFOLIO ********************/
function setMessage(newMessage)
			{
				if(document.all)	  {
					document.all.messageIE.innerHTML=newMessage;
				}
				else if(document.layers)			   {
					document.messageNS1.document.messageNS2.document.write(newMessage);
					document.messageNS1.document.messageNS2.document.close();
				}
			}
			
function setMessagePortfolio(newMessage,obj)
			{
				ieObj = eval("document.all."+obj);
				
				nsObj1 = eval("document."+obj+"1");
				nsObj2 = eval("document."+obj+"2");
				
				if(document.all)	  {
					ieObj.innerHTML=newMessage;
				}
				else if(document.layers)			   {
					nsObj1.nsObj2.document.write(newMessage);
					nsObj.nsObj2.document.close();
				}
			}
/******************************************************************/
//* COOKIE FUNCTIONS */

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

var HOST = 'localhost:200';

// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.

function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
    document.cookie = curCookie;
}

function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function deleteCookie (name, path, domain) {
    if (getCookie(name))
        document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}


	//SCROLL LIST YOUR SCHOOL FREE
	function fncMouveScroll(intJsPosition)
	{
		if (document.layers)
		{
	  		document.layers["pubBulle"].left = intJsPosition ;
	  	}
	  	if (document.all)
	  	{
	  		document.all["pubBulle"].style.left = intJsPosition ;
	  	}
	  					//NS6 : don't support document.layers mais document.getElementById
	  	else if (document.getElementById)
	  	{
	  		document.getElementById("pubBulle").style.left = intJsPosition ;
		}

		intJsPosition = intJsPosition + 1 ;
		if(intJsPosition>=600)
		{
			intJsPosition = intJsPosition - 1 ;
			intJsPosition = 300 ;		
		}
		setTimeout('fncMouveScroll('+intJsPosition+')',15) ;

	}
function fncClickChecked(FormObj,FormName) {
	var divText ;
	for(i=0;i<FormObj.length;i++) {
	
		if(FormName=="D") { divText = 'D' ; } else { divText = 'L' ; }
		if(FormName=="S") { divText = 'S' ; } 
		alert(divText);
		ObjDisplay = eval('div_'+divText+FormObj[i].value) ;
		if(FormObj[i].checked == true) {
			ObjDisplay.style.display = '' ;
		}
		else {

			ObjDisplay.style.display = 'none' ;
		}
	}
}
