﻿var deviceIphone = "iphone";
var deviceIpod = "ipod";

//Initialize our user agent string to lower case.
var uagent = navigator.userAgent.toLowerCase();

// Detects if the current device is an iPhone.
function DetectIphone()
{
   if (uagent.search(deviceIphone) > -1)
      return true;
   else
      return false;
}

// Detects if the current device is an iPod Touch.
function DetectIpod()
{
   if (uagent.search(deviceIpod) > -1)
      return true;
   else
      return false;
}

//**************************
// Detects if the current device is an iPhone or iPod Touch.
function DetectIphoneOrIpod()
{
    if (DetectIphone())
       return true;
    else if (DetectIpod())
       return true;
    else
       return false;
}

//**************************
//   PRINTING FUNCTION
function PrintArticle2()
{
myWindow=window.open('','','menubar=1,toolbar=1,status=1,location=1,directories=1,scrollbars=yes,resizable=1')
myWindow.document.write( '<sty'+'le type="text/css">'+"body {font-family:Arial,Helvetica,sans-serif;margin:20px;}\na:link {color:#000000;text-decoration:none;}\na:visited {color:#000000;text-decoration:none;}\na:hover {color:#000000;text-decoration:none;}\na:active {color:#000000;text-decoration:none;}\n"+'</st'+'yle>' );
myWindow.document.write(  ($("#dnn_ContentPane").html()).replace(/display: none/gi,"display: inline")   );
myWindow.focus();
myWindow.print();
}

function PrintArticle3()
{
var a=$('.odq_dialog');

		 $('.imprimer').css({'display':'none'});
		 myWindow=window.open('','','menubar=1,toolbar=1,status=1,location=1,directories=1,scrollbars=yes,resizable=1')
		 myWindow.document.open();
		 myWindow.document.write( '<sty'+'le type="text/css">'+"body {font-family:Arial,Helvetica,sans-serif;margin:20px;}\na:link {color:#000000;text-decoration:none;}\na:visited {color:#000000;text-decoration:none;}\na:hover {color:#000000;text-decoration:none;}\na:active {color:#000000;text-decoration:none;}\n"+'</st'+'yle>' );
		 myWindow.document.write(  (a.html())   );
		 myWindow.document.close();
		 a.css({'display':'inline'});
		 myWindow.focus();
		 myWindow.print();
}


function PrintArticle()
{
 window.print();
}

// SCROLING NEWS
var delayb4scroll=2500 ;
var marqueespeed=1 ;
var pauseit=1 ;//
var copyspeed=marqueespeed;
var pausespeed=(pauseit==0)? copyspeed: 0 ;
var actualheight='';


// ON LOAD FINISHED FUNCTION

	$(function() {
		var IE6 = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false;
        if(IE6){
			$("#bottomback").css('display', 'none');
			$("<div>")
				.css({
					'position': 'absolute',
					'top': '0px',
					'left': '0px',
					backgroundColor: 'black',
					'opacity': '0.75',
					'width': '100%',
					'height': $(window).height(),
					zIndex: 5000
				})
				.appendTo("body");
			$("<div><img src='/Portals/5/web-browsers.jpg' alt='' style='float: left;'/><p><br />Internet Explorer 6 n'est pas support&eacute; sur ce site. <a href='http://windows.microsoft.com/fr-FR/internet-explorer/products/ie/home'>Veuillez mettre &agrave; jour votre navigateur</a>.</p><p>This site does not support Internet Explorer 6. <a href='http://windows.microsoft.com/en-US/internet-explorer/products/ie/home'>To view this site, please upgrade your browser</a>.</p>")
				.css({
					backgroundColor: 'white',
					'top': '50%',
					'left': '50%',
					marginLeft: -210,
					marginTop: -100,
					width: 410,
					paddingRight: 10,
					height: 200,
					'position': 'absolute',
					zIndex: 6000
				})
				.appendTo("body");
        }
	
		$( ".odq_accordion" ).accordion({collapsible: true, active: false, autoHeight: false});
		$( ".odq_button" ).button();
		$( ".odq_tab" ).tabs();
		$( ".odq_dialog" ).dialog({
			autoOpen: false,
			open: function(event, ui) { $('.ui-widget-overlay').bind('click', function(){ $(".odq_dialog").dialog('close'); }); }
		});

		$( "#dnn_dnnSearch_cmdSearchNew").html("") ;
		
		
		$( "#dnn_dnnSearch_txtSearchNew").click(function() {
			$( "#dnn_dnnSearch_txtSearchNew").val("");
			$( "#dnn_dnnSearch_txtSearchNew").unbind('click');
		});
		
		$("#marqueecontainer").SetScroller({	velocity: 40, direction: 'vertical'  });		
		$( ".odq_rotator" ).jshowoff( {  speed:6500, controls: false }  );
		$( "p.jshowoff-slidelinks a").button();
		
		
		if($("#odqlangid").text()=="en-US" ){
			//$("#odqlangid").text("");
			$("#odqlangid").text("English");
			$("#dnn_dnnSearch_txtSearchNew").val("Recherche");
			$("#contactlink").attr('href', "/Contact/tabid/452/language/fr-CA/Default.aspx");
			$("#accueillink").attr('href', "/Accueil/tabid/127/language/fr-CA/Default.aspx");
		    
		}else{
			$("#odqlangid").text("Français");
			$("#accueillink").text("Home");
			$("#accueillink").attr('href', "/Home/tabid/149/language/en-US/Default.aspx");
			$("#contactlink").attr('href', "/ContactUs/tabid/453/language/en-US/Default.aspx");
			$("#dnn_dnnSearch_txtSearchNew").val("Search");
			if ($("#dnn_dnnLogin_cmdLogin").text() == "Membres / Étudiants" ){$("#dnn_dnnLogin_cmdLogin").text("Members / Students");}
			else
			{$("#dnn_dnnLogin_cmdLogin").text("Log out");}
		}
	
	    $( ".home-link").click(function() {
				window.location = $("#accueillink").attr("href") 
		});
	
	    $("#dnn_ctr833_dnnTitle_lblTitle").css( {'color': '#FFEE76'} );
	
	
	    // pas de print sur home 
	    //$(".art-nav-center").append( '<div style="float:right"><a href="javascript:PrintArticle();" ><img src="/images/action_print.gif" alt=" Imprimer " Title=" Imprimer " style="border-width:0;margin-right:12px;margin-top:4px;"  /></a></div>'  );
	
		$(".art-menu>li>a").click( function(event) {
			event.preventDefault();                          
			$(".art-menu").addClass("toggled-menu");
			$(".art-vmenu-body").addClass("hidevmenu");
		});
		$(".art-menu").mouseleave(function() {                          
		  $(".art-menu").removeClass("toggled-menu");
		  $(".art-vmenu-body").removeClass("hidevmenu");
		});
	
	    $("#dnn_ctr824_Login_Login_DNN_plPassword_label").hover( function() {$("#helploggin").show();},
         		function() {$("#helploggin").hide();});
	
	    $("#dnn_ctr924_Login_Login_DNN_plPassword_lblLabel").hover( function() {$("#helploggin").show();},
         		function() {$("#helploggin").hide();});			
				
				
	
		if(DetectIphoneOrIpod()){
		// empty background
		  $("#bottomback").css('background-image', 'none');
		}
		
		//PASSWORD TO LOWERCASE
		$("#dnn_ctr824_Login_Login_DNN_txtPassword").keyup( function(){ $("#dnn_ctr824_Login_Login_DNN_txtPassword").val($("#dnn_ctr824_Login_Login_DNN_txtPassword").val().toLowerCase()); });
		
		$("a.youtube").YouTubePopup({ autoplay: 1, hideTitleBar: true  });
		
		
		
		
	});
	
// Functions for NEW VERTICAL MARQUEE 	 
function scrollDown(){
    $("#slider-vertical").slider("value",$("#slider-vertical").slider("value")-1);
    }
function scrollOnLoad(){
scrollInterval = setInterval('scrollDown()', 360);
return scrollInterval;
}
//--------------------------------- 	
	
	
