// random bannerimage
var homeImages = ["sunset","tent","kite","boat","hike"];
var rand = parseInt(Math.random()*5);
var imageTag = "<img alt='Всегда впереди' src='/images03/home/" + homeImages[rand] + ".jpg' border='0' vspace='0' hspace='0' height='178' width='650'>";

// load rollover buttons
var loaded = false;
var pat_on;
var pat_off;
var pro_on;
var pro_off;
var abo_on;
var abo_off;
var srch_on;
var srch_off;
var cont_on;
var cont_off;
var map_on;
var map_off;
var go_on;
var go_off;

function loadHome() {
	pat_on = new Image();
	pat_off = new Image();
	pro_on = new Image();
	pro_off = new Image();
	abo_on = new Image();
	abo_off = new Image();
	abo1_on = new Image();
	abo1_off = new Image();
	srch_on = new Image();
	srch_off = new Image();
	cont_on = new Image();
	cont_off = new Image();
	map_on = new Image();
	map_off = new Image();
	go_on = new Image();
	go_off = new Image();
	pat_off.src = "profiim/images03/patient_off.jpg";
	pat_on.src = "profiim/images03/patient1R.jpg";
	pro_off.src = "profiim/images03/prof_off.jpg";
	pro_on.src = "profiim/images03/profR.jpg";
	abo_off.src = "profiim/images03/about_off.jpg";
	abo_on.src = "profiim/images03/aboutR.jpg";
   abo1_off.src = "profiim/images03/home_off.jpg";
	abo1_on.src = "profiim/images03/homeR.jpg";
	srch_off.src = "profiim/images03/srch_btn.JPG";
	srch_on.src = "profiim/images03/srch_btnR.jpg";
   cont_off.src = "profiim/images03/contac_btn.JPG";
	cont_on.src = "profiim/images03/contac_btnR.jpg";
	map_off.src = "profiim/images03/map_btn.jpg";
	map_on.src = "profiim/images03/map_btnR.jpg";
	loaded = true;
}

// rollovers
function rollOn (nam,num) {
	if (document.getElementById && loaded)
	document.getElementById(nam).src = eval(nam + "_on.src");
	if (num && loaded) {
		document.getElementById(nam + "Go").src = go_on.src;
	}
}
function rollOff (nam,num) {
	if (document.getElementById && loaded)
	document.getElementById(nam).src = eval(nam + "_off.src");
	if (num && loaded) {
		document.getElementById(nam + "Go").src = go_off.src;
	}
}

// search submit
function submitSearch() {
	document.searchForm.submit();
}
// select International sites
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// leftNav code
function leftNavHilite() {
	if ((document.getElementById) && (leftNavArray != null)) {
		var URL = document.URL.toLowerCase();
		for (i=0;i<leftNavArray.length;i++) {
			if ((URL.indexOf(leftNavArray[i]) != -1) && (document.getElementById(leftNavArray[i]))){
				document.getElementById(leftNavArray[i]).style.textDecoration = "underline";
				break;
			}
		}
	}
}

// search submit
function submitSearch() {
	document.searchForm.submit();
}

function printPage() {
	window.print();
}
function emailFriend() {
	window.open('/incl/email2.htm', '', 'height=420,width=400,scrollbars=0,locationbar=0,statusbar=0,menubar=0');
}
function popWin(path,h,w) {
	var attrib = "menubar,scrollbars=no,locationbar=no,statusbar=no,left=20,top=20,height=" + h + ",width=" + w;
	window.open(path,'',attrib);
}   

function linkAlertJS(url) {
	if (confirm('You have just clicked on a link that will take you from the Guidant website to another site.\n\nGuidant does not review or monitor the content on the linked site and is not responsible for any communication or transactions you might have with them. Your use of the linked site is subject to the terms and conditions, including the privacy policy, of the linked site.')) {
	location.href=url;
	}
} 

function popWin(path,h,w) {
	var attrib = "menubar,scrollbars=no,locationbar=no,statusbar=no,left=20,top=20,height=" + h + ",width=" + w;
	window.open(path,'',attrib);
}

function popWin(path,h,w) {
	var attrib = "menubar,scrollbars=no,locationbar=no,statusbar=no,left=20,top=20,height=" + h + ",width=" + w;
	window.open(path,'',attrib);
}   

var currentopensubmenu = null
var currentsetmenu = null;
var currentimage = null;
var submenutimer = null;
function topnavover(submenuid, imageref, src) {
	var imageobj = eval("document.images."+imageref);
	if (imageobj) {
		imageobj.src = src;
		currentimage = imageobj;
	}
	hideallsubmenus();
	var submenustyle = getsubmenustyle(submenuid);
	if (submenustyle != null) {
		submenustyle.visibility = "visible";
		currentopensubmenu = getID(submenuid);
	}
}
function topnavout(imageref, src) {
	var imageobj = eval("document.images."+imageref);
	if (imageobj) {
		imageobj.src = src;
	}
	currentimage = null;
	initclose();
}
function initclose() {
	if (submenutimer != null) {
		window.clearTimeout(submenutimer);
	}
	submenutimer = window.setTimeout('hideopenmenu()', 2000);

}
function hideopenmenu() {
	if (currentsetmenu == null && currentimage == null) {
		hideallsubmenus();
	}
	else {
		initclose();
	}
}
function hideallsubmenus() {
	hidesinglemenu("SubMenu1");
	hidesinglemenu("SubMenu2");
	hidesinglemenu("SubMenu3");
	hidesinglemenu("SubMenu4");
	hidesinglemenu("SubMenu5");
	hidesinglemenu("SubMenu6");
	currentopensubmenu = null;
}
function hidesinglemenu(ref) {
	var menuobj = getsubmenustyle(ref);
	if (menuobj && menuobj != null) {
		menuobj.visibility = "hidden";
	}
}
function setmenu(divObj) {
	currentsetmenu = divObj;
}
function unsetmenu() {
	currentsetmenu = null;
}
function getsubmenustyle(subMenuID) {
	var objectRef = null;
	if (document.all && eval('document.all.' + subMenuID)) {
		objectRef = eval('document.all.' + subMenuID);
	}
	else if (document.getElementById && document.getElementById(subMenuID)) {
		objectRef = document.getElementById(subMenuID);
	}
	else if (document.layers && document.layers[subMenuID]) {
		objectRef = document.layers[subMenuID];
	}
	if (objectRef == null) {
		return null;
	}
	else if (objectRef.style) {
		return objectRef.style;
	}
	else {
		return objectRef;
	}
}


//=======================================//
// Left Hand Navigation Functions
//=======================================//
var defaultrow = null;
function leftnavon(obj) {
	if (obj.className) obj.className = "leftnavon";
}
function leftnavoff(obj) {
	if (obj != defaultrow && obj.className) obj.className = "leftnavoff";
}


//=======================================//
// Left hand compass functions
//=======================================//
var compassinitialised = false;
var mainnav = null;
var subnav = null;
var currentcell = null;
function compassleftnavover(imageref) {
	var imageobj = eval("document.images."+imageref);
	if (imageobj) {
		var endstub = imageobj.src.substring(imageobj.src.length-7).toLowerCase();
		if (endstub != "-hl.gif") {
			imageobj.src = imageobj.src.substring(0, imageobj.src.length-4)+"-hl.gif";
		}
	}
}
function compassleftnavout(imageref) {
	var imageobj = eval("document.images."+imageref);
	if (imageobj && imageobj != currentcell) {
		var endstub = imageobj.src.substring(imageobj.src.length-7).toLowerCase();
		if (endstub == "-hl.gif") {
			imageobj.src = imageobj.src.substring(0, imageobj.src.length-7)+".gif";
		}
	}
}
function expandcompasselement(ptr) {
	//===================================================//
	// Highlight the image
	//===================================================//
	var imageobj = eval("document.images.leftnavimage"+ptr);
	if (imageobj) {
		currentcell = imageobj;
		compassleftnavover("leftnavimage"+ptr);
	}

	//===================================================//
	// Expand the selected element
	//===================================================//
	var oMainNav = null;
	var oSubNav = null;
	if (!compassinitialised) {
		//===================================================//
		// Make array of elements (if not already created)
		//===================================================//
		var sectioncount = 0;
		oMainNav = getID("mainnav"+sectioncount);
		while (oMainNav != null) {
			sectioncount++;
			oMainNav = getID("mainnav"+sectioncount);
		}
		mainnav = new Array(sectioncount);
		subnav = new Array(sectioncount);
		for (var ii=0; ii<sectioncount; ii++) {
			mainnav[ii] = new menuobj("mainnav"+ii);
			subnav[ii] = new menuobj("subnav"+ii);
		}
		compassinitialised = true;
	}
	if (ptr < mainnav.length) {
		var offset = 0;
		for (var ii=0; ii<mainnav.length; ii++) {
			mainnav[ii].nudge(offset);
			if (subnav[ii] != null) {
				if (ptr == ii) {
					offset = subnav[ii].height;
					subnav[ii].show();
				}
				else {
					subnav[ii].hide();
				}
			}
		}
	}
}
function menuobj(ref) {
	//================================//
	// Properties
	//================================//
	this.obj = getID(ref);
	this.height = 0;
	this.startX = 0;

	//================================//
	// Methods
	//================================//
	this.gettop = function() {
		if (this.obj == null) {
			return 0;
		}
		if (this.obj.offsetTop) {
			return parseInt(this.obj.offsetTop);
		}
		else if (this.obj.top) {
			return parseInt(this.obj.top);
		}
		else {
			return 0;
		}
	}
	this.getheight = function() {
		if (this.obj == null) {
			return 0;
		}
		if (this.obj.offsetHeight) {
			return parseInt(this.obj.offsetHeight);
		}
		else if (this.obj.document && this.obj.document.height) {
			return parseInt(this.obj.document.height);
		}
		else {
			return 0;
		}
	}
	this.nudge = function(offset) {
		this.settop(this.startX + offset);
	}
	this.settop = function(ycoord) {
		if (this.obj == null) {
			return null;
		}
		else if (this.obj.style) {
			this.obj.style.top = ycoord;
		}
		else if (this.obj.top) {
			this.obj.top = ycoord;
		}
	}
	this.hide = function() {
		if (this.obj == null) {
			return null;
		}
		else if (this.obj.style) {
			this.obj.style.visibility = "hidden";
		}
		else if (this.obj.visibility) {
			this.obj.visibility = "hidden";
		}
	}
	this.show = function() {
		if (this.obj == null) {
			return null;
		}
		else if (this.obj.style) {
			this.obj.style.visibility = "visible";
		}
		else if (this.obj.visibility) {
			this.obj.visibility = "visible";
		}
	}

	//================================//
	// Initialise
	//================================//
	this.height = this.getheight();
	this.startX = this.gettop();
}


//=======================================//
// General functions
//=======================================//
function getID(ID) {
	var objectRef = null;
	if (document.all && eval('document.all.' + ID)) {
		objectRef = eval('document.all.' + ID);
	}
	else if (document.getElementById && document.getElementById(ID)) {
		objectRef = document.getElementById(ID);
	}
	else if (document.layers && document.layers[ID]) {
		objectRef = document.layers[ID];
	}
	return objectRef;
}

function findfirstanchor(obj) {
	if (obj.nodeType != 1) {
		return null;
	}
	else if (obj.tagName && obj.tagName != null && obj.tagName.toUpperCase() == "A") {
		return obj;
	}
	else if (obj.childNodes) {
		return findfirstanchor(obj.childNodes[0]);
	}	
	else {
		return null;
	}
}
var popUpViewer = null;
function popViewer(nam, width, height) {
	if (width == null) width='550';
	if (height == null) height = '300';
	var attrib="left=10,top=10,height=" + height + ",width=" + width + ",scrollbars=1,locationbar=0,statusbar=0,menubar=0,resizable=1";
	if (popUpViewer && popUpViewer.open && !popUpViewer.closed) {
		popUpViewer.close();
		popUpViewer = window.open(nam, 'popviewer', attrib);
		}	
	else
		popUpViewer = window.open(nam, 'popviewer', attrib);
}
function emailthispage(){
	var attrib="left=10,top=10,height=400,width=500,scrollbars=1,locationbar=1,statusbar=0,menubar=0,resizable=1";
	var subject = window.document.title;
	var thisurl = window.location;
	var url = "cgi-bin/general/emailthispage/@subject=" + escape(subject) + "&url=" + escape(thisurl);
	window.open(url, "emailwin", attrib);
}

//=======================================//
// Initialise the page's left navigation
//=======================================//
function InitLeftNav() {
	var URL = document.URL.toLowerCase();
	var lefthandcontainer = getID("leftnavcontainer");
	if (lefthandcontainer && lefthandcontainer != null && lefthandcontainer.rows) {
		for (var ii=0; ii<lefthandcontainer.rows.length; ii++) {
			if (lefthandcontainer.rows[ii].cells) {
				var anchor = findfirstanchor(lefthandcontainer.rows[ii].cells[0]);
				if (anchor != null) {
					var thisURL =anchor.href.toLowerCase();
					if (URL == thisURL || URL == thisURL + "index.shtml" || URL + "index.shtml" == thisURL || URL + "index.shtml" == thisURL + "index.shtml") {
						leftnavon(lefthandcontainer.rows[ii].cells[0]);
						defaultrow = lefthandcontainer.rows[ii].cells[0];
						return false;
					}
				}
			}
		}
	}
}

//=======================================//
// This function is used on the home page
// to re-position the sub menu items
//=======================================//
function NudgeSubMenu(ref) {
	var obj = getsubmenustyle(ref);
	if (obj && obj != null) {
		obj.top = 257;
	}
}  
//=======================================//
function feedback(num,result) {
	if(result=="correct") {
		document.getElementById(num + "_result").firstChild.nodeValue = eval(num + "_correct");
	}
	else {
		document.getElementById(num + "_result").firstChild.nodeValue = eval(num + "_wrong");
	}
}
      
var message="";

function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")

function disableselect(e){
return false
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}

