// GLOBAL JAVASCRIPT FILE
//---------------------------------------------------------------------------------------------------------



//-----------------------------------------
//Set Default Font Sizes
var fontsize = 11;  
var fontfamily = "Verdana, Arial, Helvetica, sans-serif"
var fontchanged = false;

//-----------------------------------------
// 	Set Cookies
//	Check if user previously set values stored in a cookie
if(getCookie("font-size")) { fontsize = getCookie("font-size");}
if(getCookie("font-style")) { fontfamily = getCookie("font-style");}


//-----------------------------------------
//  SET FONT SIZES
//	- Set the default fonts
//-----------------------------------------
function setContentFonts() {
	
	//Set fonts only if the fontcontents div exists
	if ((document.getElementById('contents'))!=null) 
	{ 
		document.getElementById('contents').style.fontSize = fontsize + "px"; 
		document.getElementById('contents').style.fontFamily = fontfamily; 
	}
}





//-----------------------------------------
//	CHANGE FONT SIZE
//	- Functions that Changes the font size/ style
//	- Takes ID as parametes, change is either "increase" or "decrease
//-----------------------------------------
function changefontSize(id,change) {
if((change=="increase")&&(fontsize<14)){fontsize++; document.getElementById(id).style.fontSize = fontsize + "px";}
else if((change=="decrease")&&(fontsize>10)){fontsize--; document.getElementById(id).style.fontSize = fontsize + "px";}
	else if(change=="style")
	{
		if(fontchanged==false)
		{
			fontchanged=true; 
			fontfamily = "Times New Roman, Times, serif"; 
			document.getElementById(id).style.fontFamily =fontfamily;

		}
		else 
		{
			fontchanged=false;
			fontfamily = "Verdana, Arial, Helvetica, sans-serif"; 
			document.getElementById(id).style.fontFamily =fontfamily;}
	}
	
	document.cookie = 'font-size=' + fontsize;
	document.cookie = 'font-style=' + fontfamily;
}





//-----------------------------------------
//	CHANGE LANGUAGE
//-----------------------------------------
function ChangeLanguage() {

window.alert("Our Webpage is Currently Being Translated Into Various Languages.\nPlease Come Back Soon to Read CanadianInternship.com in Your Language!\ ");
}




//-----------------------------------------
//	GET COOKIE
//  - Takes an ID element name
//	- Returns the value of an element in a cookie by its ID
//-----------------------------------------

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}



//-----------------------------------------
//	PUPUP FUNCTION	
//  - Takes URL, Width, Height, Scroll
//    Creates a window of size width x height 
//    From the passed URL
//-----------------------------------------
	function popupURL(url, x, y, scroll)
	{
	  ua = window.navigator.userAgent;
	  NS  = (document.layers) ? 1 : 0;
	  PCIE = (ua.indexOf( "MSIE " ) && ua.indexOf("Win")) ? 1 : 0;
	
	  if(NS || PCIE) { x += 15; y += 15; } // Grrr...
	
	  urlWindow = open(url, "urlWindow", "width=" + x + ",height=" + y + ",scrollbars=" + ((scroll) ? "yes" : "no") + ",status=no,toolbar=no,resizable=yes");
	
	  return false;
	}
	
	
//-----------------------------------------
//BOOKMARK FUNCTION
//-----------------------------------------
var urlAddress = "http://www.canadianinternship.com"; 
var pageName = "CanadianInternship.com: Find Internship in Canada!"; 
function addToFavorites() 
{ 
	if (window.external) { window.external.AddFavorite(urlAddress,pageName) } 
	else { alert("Sorry! Your browser doesn't support this function."); } 
	
} 
	
	
	
	
	
