function PrintPage()
{ 
  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      disp_setting+="scrollbars=yes,resizable=yes"; 
  var content_value = document.getElementById("page_content").innerHTML; 
  
  var docprint=window.open("","",disp_setting); 
   docprint.document.open(); 
   docprint.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" />'); 
   docprint.document.write('<html>'); 
   docprint.document.write('<head>'); 
   docprint.document.write('<title> RYERSON UNIVERSITY - Toronto, Ontario, Canada </title>'); 
   docprint.document.write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'); 
   docprint.document.write('<meta name="keywords" content="">'); 
   docprint.document.write('<meta name="description" content="">'); 
   docprint.document.write('<link href="http://www.ryerson.ca/inc/main-print.css" rel="stylesheet" type="text/css" />'); 
   docprint.document.write('<link rel="shortcut icon" href="http://www.ryerson.ca/favicon.ico.jpg" type="image/x-icon" />'); 
   docprint.document.write('</head>'); 
   docprint.document.write('<body>'); 
   docprint.document.write('<div id="viewport">'); 
   docprint.document.write('<div id="siteframe">'); 
   docprint.document.write('<div id="bannernav">'); 
   docprint.document.write('<div id="bannerlogo"><a href="http://www.ryerson.ca/index.html"><img src="http://www.ryerson.ca/images/new/logo_ryerson.gif" alt="RYERSON UNIVERSITY" width="273" height="48" border="0"></a></div>'); 
   docprint.document.write('</div>'); 
   docprint.document.write('<div id="contentarea">'); 
   docprint.document.write('<div id="main_content_panel">'); 
   docprint.document.write(content_value);          
   docprint.document.write('</div>'); 
   docprint.document.write('<BR clear="all">'); 
   docprint.document.write('<div id="footer_area">'); 
   docprint.document.write('<div id="footer_blurb">'); 
   docprint.document.write('&copy; Ryerson University &nbsp;&nbsp;&nbsp;'); 
   docprint.document.write('</div>'); 
   docprint.document.write('</div>'); 
   docprint.document.write('</div>'); 
   docprint.document.write('</body></html>'); 
   docprint.document.close(); 
   docprint.focus(); 
}


function getContent(myUrl){
    	  var page_request = false;
		if (window.XMLHttpRequest) // if Mozilla, Safari etc
		{		
			page_request = new XMLHttpRequest();
		}
		else if (window.ActiveXObject){ // if IE
					try {
							page_request = new ActiveXObject("Msxml2.XMLHTTP");
					} 
					catch (e){
							try{
							page_request = new ActiveXObject("Microsoft.XMLHTTP");
							}
							catch (e){
								}
					}
		}
		else{
				return false;
		}
		
			page_request.open('GET', myUrl, false); //get page synchronously 
			page_request.send(null);
			
			if (page_request.readyState == 4){
					if(page_request.status==200){
						       if (document.getElementById("temparea")){
 						       	document.getElementById("temparea").innerHTML = page_request.responseText;
						       }
						       else{
						         document.write("<div id=\"temparea\" style=\"display: none;\">"+page_request.responseText+"</div><!--end of display:none-->");
						      }
					}
				  else{
				  	alert("page_request.status==200 has problem");
				  }
				  	
			}
			else{
				  	alert("page_request.readyState == 4 has problem");
			}
	}
	
function displayContent(myID){
									 var contents = document.getElementById(myID).innerHTML;
				           document.write("<div>"+contents+"</div>");
	}
function displayRightFeature(){
									 var contents = document.getElementById("temparea").innerHTML;
				           document.write(contents);
	}
	
function cleanTemp(){
document.getElementById("temparea").innerHTML="";
	}


function verification() {
var themessage = "You are required to complete the following Contact Form items:\n";

document.emailThisPage.mailformToEmail.className='form_nohilite';
document.emailThisPage.mailformFromEmail.className='form_nohilite';
document.emailThisPage.mailformFromName.className='form_nohilite';

if (document.emailThisPage.mailformToEmail.value=="") {
themessage = themessage + "- To: Email Address\n";
document.emailThisPage.mailformToEmail.className='form_hilite';
}

if (document.emailThisPage.mailformFromEmail.value=="") {
themessage = themessage + "- From: Email Address\n";
document.emailThisPage.mailformFromEmail.className='form_hilite';
}

if (document.emailThisPage.mailformFromName.value=="") {
themessage = themessage + "- From: Name\n";
document.emailThisPage.mailformFromName.className='form_hilite';
}

//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following Contact Form items:\n") {
setContent();
}
else {
alert(themessage);
//return false;
   }
}

function setContent() {

if (document.emailThisPage.fromMessage.value=="") {
var messageString = document.emailThisPage.mailformFromName.value +" (" + document.emailThisPage.mailformFromEmail.value + ") saw this page on Ryerson.ca and thought you might be interested. To view the page, please copy and paste the following address into your web browser's address bar: \n\n" + document.messageTemp.pageURL.value + " \n_________________________________________________________________\n\n"+ document.messageTemp.disclaimer.value;
document.emailThisPage.Message_Text.value=messageString;
document.emailThisPage.submit();
} else {
var messageString = document.emailThisPage.mailformFromName.value +" (" + document.emailThisPage.mailformFromEmail.value + ") saw this page on Ryerson.ca and thought you might be interested. To view the page, please copy and paste the following address into your web browser's address bar: \n\n" + document.messageTemp.pageURL.value + " \n\nMessage from "+document.emailThisPage.mailformFromName.value+": \n"+document.emailThisPage.fromMessage.value+"\n_________________________________________________________________\n\n"+ document.messageTemp.disclaimer.value;
document.emailThisPage.Message_Text.value=messageString;
document.emailThisPage.submit();
}

}


function EmailPage()
{ 
  var mydisp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      mydisp_setting+="scrollbars=yes,resizable=yes"; 
  var mycurrentUrl=window.location.href; 
  var myinnerHTML='<style type="text/css">';
						myinnerHTML+='.emailBorder {';
						myinnerHTML+='border: 1px solid #ccc;';
						myinnerHTML+='padding: 10px;';
						myinnerHTML+='background-color:#f8fafc;';
						myinnerHTML+='font-size:12px;';
						myinnerHTML+='color:#333333;';
						myinnerHTML+='}';
						
						myinnerHTML+='.form_hilite {';
						myinnerHTML+='background-color:#fff5a3;';
						myinnerHTML+='width: 180px;';
						myinnerHTML+='}';
						
						myinnerHTML+='.form_nohilite {';
						myinnerHTML+='background-color:#ffffff;';
						myinnerHTML+='width: 180px;';
						myinnerHTML+='}';
						
						myinnerHTML+='.form_hilite_textbox {';
						myinnerHTML+='background-color:#fff5a3;';
						myinnerHTML+='width: 300px;';
						myinnerHTML+='}';
						
						myinnerHTML+='.mandatory {';
						myinnerHTML+='color: #FF0000;';
						myinnerHTML+='}';
						
						
						myinnerHTML+='</style>';
						  
						
						myinnerHTML+='  <h2 style="position: relative;">Email This Page:</h2>';
						myinnerHTML+='  <strong style="position: relative;">';
						myinnerHTML+='      <a href="'+mycurrentUrl+'">'+mycurrentUrl+'</a>';
						myinnerHTML+='  </strong>';
							 
						myinnerHTML+='<div style="display: none;"> ';
						myinnerHTML+='<FORM name="messageTemp">';
						myinnerHTML+='<textarea name="pageURL">'+mycurrentUrl+'</textarea>';
										 
						myinnerHTML+='  <textarea name="disclaimer" cols="50" rows="3" READONLY>Ryerson University is not responsible for the content of this e-mail and the content included in this e-mail does not reflect Ryerson\'s views or opinions. Please note that neither the e-mail address nor name of the sender have been verified.';
						myinnerHTML+='  </textarea> ';
						
						myinnerHTML+='</FORM>';
						myinnerHTML+='</div>';
						myinnerHTML+='<br><br>';
						myinnerHTML+='<FORM name="emailThisPage" ACTION="http://www.ryerson.ca/webapps-cgi/emailPage" METHOD="POST">';
						 
						myinnerHTML+='  <h2>To: </h2>';
						myinnerHTML+='    <INPUT TYPE="hidden" NAME="mailformSubject" value="A link from Ryerson.ca">';
						myinnerHTML+='	  <INPUT TYPE="hidden" NAME="Message_Text" value="">';
						
						myinnerHTML+='  <div class="emailBorder">';
						myinnerHTML+='    <strong><span class="mandatory">* </span>Email Address</strong><br>';
						myinnerHTML+='      <INPUT NAME="mailformToEmail" TYPE="text" class="form_nohilite" value="">';
						myinnerHTML+='  </div>';
						myinnerHTML+='  <br><br>';
						  
						myinnerHTML+='  <h2> From: </h2>';
						myinnerHTML+=' <div class="emailBorder">';
						myinnerHTML+='   <strong><span class="mandatory">* </span>Email Address</strong><br>';
						myinnerHTML+='  <INPUT NAME="mailformFromEmail" TYPE="text" id="mailformFromEmail" value="" class="form_nohilite">';
						myinnerHTML+='  <br>';
						myinnerHTML+='  <br>';
						myinnerHTML+='  <strong><span class="mandatory">* </span>Name</strong><br>';
						myinnerHTML+='  <INPUT NAME="mailformFromName" TYPE="text" id="mailformFromName" value="" class="form_nohilite">';
						myinnerHTML+='  <br>';
						myinnerHTML+='  <br>';
						myinnerHTML+='  <strong>Message</strong><br>';
						myinnerHTML+='  <textarea name="fromMessage" cols="30" rows="4" id="fromMessage"></textarea>';
						myinnerHTML+='  <br>';
						myinnerHTML+='  <INPUT TYPE="hidden" NAME="ThankYouPage" VALUE="http://www.ryerson.ca/emailReturn/emailPgThy.html">';
						myinnerHTML+='  </div>';
						
						myinnerHTML+=' <br><br>';
						myinnerHTML+='  <INPUT TYPE=button value="Send" onclick="verification();" >';
						myinnerHTML+='  <br>';
						myinnerHTML+='  <br>';
						myinnerHTML+=' The e-mail addresses you enter are used only to send articles and ';
						myinnerHTML+='notify you if an e-mail could not be delivered.  We do not save the ';
						myinnerHTML+='email addresses that you provide to us.';
						myinnerHTML+='</FORM>';  
		var today = new Date();
		var year = today.getFullYear();
	  var myfooter='<div id="footer_area">';
				myfooter+='   <div id="footer_blurb">';
				myfooter+='		&copy; '+ year + ' Ryerson University &nbsp;&nbsp;&nbsp;';
				myfooter+='      		<a href="http://www.ryerson.ca/ryerson.ca/webpolicy.html">Web Policy</a> &nbsp;&nbsp;&nbsp;';
				myfooter+='      		<a href="http://www.ryerson.ca/ryerson.ca/privacy.html">Privacy Policy</a> &nbsp;&nbsp;&nbsp;';
				myfooter+='			<a href="administration_studentaffairs/access-plan/">Accessibility</a> &nbsp;&nbsp;&nbsp;';
				myfooter+='			<a href="http://www.ryerson.ca/ryerson.ca/terms.html">Terms &amp; Conditions</a>';
				myfooter+='			</div>';
				myfooter+='</div>';
	 var toolbar_value = document.getElementById("toolbar").innerHTML; 
	 var content_value = document.getElementById("page_content").innerHTML; 
	 var footer_value = document.getElementById("footer_area").innerHTML; 
	 var first = '';
	 var first1 = '';
	 var first2 = '';
	 var second='';
	 var third='';
	 var myouterHTML='';
	 var browserName=navigator.appName;
	 if (browserName=="Netscape"){
	 	myouterHTML+='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" />'+document.getElementsByTagName("html")[0].innerHTML;
	}
	else{
		myouterHTML+='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" />'+document.documentElement.outerHTML;
	}
	 first += myouterHTML.replace(toolbar_value,'');
	 first1 += first.replace(/<div id="toolbar">[\s]*<\/div>/i,'');
	 first2 += first1.replace(/<div id=toolbar>[\s]*<\/div>/i,'');
	 second += first2.replace(content_value,myinnerHTML);
	 third += second.replace(footer_value,myfooter);
	 var mydocprint=window.open("","",mydisp_setting); 
   mydocprint.document.open(); 
   mydocprint.document.write(third); 
   mydocprint.document.close(); 
   mydocprint.focus(); 
}

function EmailPage1()
{
  var mycurrentUrl=window.location.href; 
  var mydisp_setting="toolbar=yes,location=yes,directories=yes,menubar=yes,"; 
      mydisp_setting+="scrollbars=yes,resizable=yes"; 
   var third='<html><head></head><body></body></html>';
   
	 var mydocprint=window.open("","",mydisp_setting); 
   mydocprint.document.open(); 
   mydocprint.document.write(third); 
   mydocprint.document.close(); 
   mydocprint.focus(); 

var myBody=mydocprint.document.getElementsByTagName("BODY").item(0);

var myForm = mydocprint.document.createElement("FORM");
myForm.setAttribute("name","CaptchaMailThisPage");
myForm.setAttribute("action","/webapps-cgi/jsp/email/emailThisPage.jsp");
myForm.setAttribute("method","post");
myBody.appendChild(myForm);

var myURL = mydocprint.document.createElement('input');
  myURL.setAttribute('name', 'myURL');
  myURL.setAttribute('type', 'hidden');
  myURL.setAttribute('value', mycurrentUrl); 

myForm.appendChild(myURL);

myForm.submit();

}

function clientSideInclude(divname)
{
var sitename = document.getElementById(divname).innerHTML;
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4&& xmlhttp.status==200)
    {
		document.getElementById(divname).innerHTML=xmlhttp.responseText;
		document.getElementById(divname).style.border = "0px";
		var scriptarr = document.getElementById(divname).getElementsByTagName("script");
		var appendScriptArr = new Array();
		var spanIncludes = document.createElement('span');
		spanIncludes.setAttribute("id",divname+"span");
		document.getElementById(divname).parentNode.insertBefore(spanIncludes,null);

		var t = scriptarr.length;
		for (var x=0;x<t;x++){
			var appendNum = Math.floor(Math.random()*999999);
			eval('newDivIncX'+appendNum+' = document.getElementById(divname+"span");');
			var newScript = document.createElement('script');
			newScript.type = "text/javascript";
			if(scriptarr[x].text.indexOf("CQ.WCM.edit") == -1&& scriptarr[x].text.indexOf("CQ.WCM.launch") == -1&& scriptarr[x].text.indexOf("CQClientLibraryManager.write") == -1){				
				newScript.text = scriptarr[x].text;
				while(newScript.text.indexOf("document.write(") != -1){
					newScript.text = newScript.text.substring(0,newScript.text.indexOf("document.write(")) + "newDivIncX"+appendNum + ".innerHTML += " + newScript.text.substring(newScript.text.indexOf("document.write(")+15,newScript.text.indexOf(");",newScript.text.indexOf("document.write("))+0) + newScript.text.substring(newScript.text.indexOf(");",newScript.text.indexOf("document.write("))+1);
				}
				while(newScript.text.indexOf("document.writeln(") != -1){
					newScript.text = newScript.text.substring(0,newScript.text.indexOf("document.writeln(")) + "newDivIncX"+appendNum + ".innerHTML += " + newScript.text.substring(newScript.text.indexOf("document.writeln(")+17,newScript.text.indexOf(");",newScript.text.indexOf("document.writeln("))+0) + newScript.text.substring(newScript.text.indexOf(");",newScript.text.indexOf("document.writeln("))+1);
				}
				
				appendScriptArr.push(newScript);
				
			}			
		}
		
		var length = scriptarr.length;
		while (length--){
		scriptarr[length].parentNode.removeChild(scriptarr[length]);
		}
		var removeEditImages = document.getElementById(divname).innerHTML;

		while(removeEditImages.indexOf('<img src="/libs/cq/ui/resources/0.gif" class="cq-text-placeholder" alt="">') != -1){
					removeEditImages = removeEditImages.substring(0,removeEditImages.indexOf('<img src="/libs/cq/ui/resources/0.gif" class="cq-text-placeholder" alt="">')) + removeEditImages.substring(removeEditImages.indexOf('<img src="/libs/cq/ui/resources/0.gif" class="cq-text-placeholder" alt="">')+74);
		}
		while(removeEditImages.indexOf('<img title="" alt="" class="cq-dd-image cq-image-placeholder" src="/etc/designs/default/0.gif">') != -1){
					removeEditImages = removeEditImages.substring(0,removeEditImages.indexOf('<img title="" alt="" class="cq-dd-image cq-image-placeholder" src="/etc/designs/default/0.gif">')) + removeEditImages.substring(removeEditImages.indexOf('<img title="" alt="" class="cq-dd-image cq-image-placeholder" src="/etc/designs/default/0.gif">')+95);
		}
				
		spanIncludes.innerHTML = removeEditImages;

		document.getElementById(divname).parentNode.replaceChild(spanIncludes,document.getElementById(divname));
		for (i=0;i<appendScriptArr.length;i++)
		{
			spanIncludes.appendChild(appendScriptArr[i]);
		}
    }
  }
  var customUrl = "";
  if(sitename.indexOf("deptList") >= 0){
  	customUrl = window.location.protocol+"//"+window.location.host+"/content/dam"+sitename;
  }else if(window.location.hostname == "www.ryerson.ca" || window.location.hostname == "www.dev.ryerson.ca" || window.location.hostname == "www.cq.ryerson.ca" ||  sitename.indexOf("/content/dam/") >= 0){
  	customUrl = window.location.protocol+"//"+window.location.host+sitename;
  }else{
  	customUrl = window.location.protocol+"//"+window.location.host+"/content/ryerson/"+sitename;
  }
//alert(customUrl);

xmlhttp.open("GET",customUrl,true);
xmlhttp.send();
}

