function launchPopup(this_url, width, height){
	//window.open(url, 'Chinook Multimedia Popup' , 'height='+height+',width='+width+', resizeable=yes, scrollbars=yes');
	window.open(this_url, 'chinook_popup' , 'height='+height+',width='+width+', resizeable=yes, scrollbars=yes');

}


function displayActiveHeaderButtons(section){
	var div_id="header_btn_"+section;
	if(document.getElementById(div_id)){
		document.getElementById(div_id).style.marginTop="-52px";
	}
	replace_cc_buttons();
}


function newTab(this_url){
	window.open(this_url);	
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// start of google maps code ////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////

function initialize() {
      if (GBrowserIsCompatible()) {
		geocoder = new GClientGeocoder;
		chinookLatLong = geocoder.getLocations("10230 Jasper Avenue, Edmonton, Alberta, Canada", addToMap);
       // map.setCenter(new GLatLng(37.4419, -122.1419), 15);
       	alert(chinookLatLong.Placemark[0].coordinates[1]);
	   
      }
    }
	
	function addToMap(response)
   {
      // Retrieve the object
      place = response.Placemark[0];

      // Retrieve the latitude and longitude
      point = new GLatLng(place.Point.coordinates[1],
                          place.Point.coordinates[0]);
						  
      var map = new GMap2(document.getElementById("map"));

      // Center the map on this point
      map.setCenter(point, 15);

      // Create a marker
      marker = new GMarker(point);

      // Add the marker to map
      map.addOverlay(marker);

      // Add address information to marker
	  mapCaption  = "<p class=\"mapCaption\">";
	  mapCaption += "<strong>Chinook Multimedia</strong><br />\n";
	  mapCaption += "4120 - 10230 Jasper Ave.<br />\n";
	  mapCaption += "Edmonton, Alberta<br />\n";
	  mapCaption += "T5J-4P6\n";
	  mapCaption += "</p>";
      marker.openInfoWindowHtml(mapCaption);
   }
	
///////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////// end of google maps code /////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////


//
last_tab_visible="overview_tab";
last_tab_content_visible="overview_content";

function changeTabs(tab_name, t_swfPath, t_flashVars, t_width, t_height, t_flashVersion){
	tab_id=tab_name+"_tab";
	tab_content_id=tab_name+"_content";

	document.getElementById(tab_id).className="active_tab";
	document.getElementById(tab_content_id).style.visibility="visible";
	if(document.getElementById(last_tab_visible)){
		document.getElementById(last_tab_visible).className="innactive_tab";
		document.getElementById(last_tab_content_visible).style.visibility="hidden";
	}
	last_tab_visible=tab_id;
	last_tab_content_visible=tab_content_id;

	flashHolder=document.getElementById('cooleShow_holder');
	if(flashHolder){
		loadFlashMovie(t_swfPath, t_flashVars, t_width, t_height, "cooleShow_holder", t_flashVersion);
	}
}

function getTabsHeight(){
	if(document.getElementById('tab_holder')){
		if(document.getElementById('overview_content').offsetHeight){
			var contentHeights = new Array(4);
			contentHeights[0]=document.getElementById('overview_content').offsetHeight;
			contentHeights[1]=document.getElementById('benefits_content').offsetHeight;
			contentHeights[2]=document.getElementById('reasons_to_buy_content').offsetHeight;
			contentHeights[3]=document.getElementById('purchase_content').offsetHeight;

		}else{
			var contentHeights = new Array(4);
			contentHeights[0]=document.getElementById('overview_content').innerHeight;
			contentHeights[1]=document.getElementById('benefits_content').innerHeight;
			contentHeights[2]=document.getElementById('reasons_to_buy_content').innerHeight;
			contentHeights[3]=document.getElementById('purchase_content').innerHeight;

		}
		var tab_holder_height=contentHeights.sort(sortNumber)[3];
		document.getElementById('tab_content_inner_holder').style.height=tab_holder_height+"px";
	}
}

function sortNumber(a,b){
	return a - b;
}

function highlightInput(inputName, state){
	if(state=="active"){
		document.getElementById(inputName).style.backgroundColor="#FEFEA0";
	}else{
		document.getElementById(inputName).style.backgroundColor="#FFFFFF";
	}
}


function swap_image(id, new_image){
	document.getElementById(id).src=new_image;
}

function launchCooleCreate(){
		width=755;
		height=500;
		OpenWin = this.open("pres_tool_sa.php", "cooleCreate", "toolbar=no, menubar=no ,location=no, scrollbars=yes, resizable=yes, width=" + width + ", height=" + height + ", top=" + (screen.height/2 - height/2) + ", left=" + (screen.width/2 - width/2) + "\""); 
	
}

function onload_cooleCreate_demo(){
	document.getElementById("email_id").focus();
	highlightInput("email_id", 'active');
	replace_cc_buttons();
}

function open_cooleCreate_pdf(){
	OpenTab=this.open('pdf/cooleCreate.pdf');	
}

function open_new_tab(url){
	OpenTab=this.open(url);	
}

function swap_buttons(title, src, state){
	if(state=="up"){
		new_src=src.replace("_over", "_up");
	}else{
		new_src=src.replace("_up", "_over");
	}
	document.getElementById(title).src=new_src;
}

function replace_cc_buttons(){
	if(document.getElementById('login_submit_holder')){
		var new_button= "<img src=\"images/btn_login_up.jpg\" alt=\"Login as a guest\" id=\"guest_image\"";
		new_button+=" onmouseover=\"swap_image(this.id, 'images/btn_guest_over.jpg');\""; 
		new_button+=" onmouseout=\"swap_image(this.id, 'images/btn_guest_up.jpg');\" \/>";
		
		//alert(new_button);
		document.getElementById('login_submit_holder').write=new_button;
	
	}
}