function ShowPhoto(url) {
	var scroll = "no";
	if(screen.width < 1000)	{scroll = "yes";}
	window.open(url, '_blank', 'width=0, height=0, menubar=no, scrollbars=' + scroll + ', status=no, top=0, left=0');
}

function GetObj(objId) {
	if (navigator.appName.substring(0,2) !="Mi")
		return document.getElementById(objId);
	else
		return document.all[objId];
}
		
function GetAbsoluteTop(obj_id) {
   var obj;
   var result = 0;
   obj = GetObj(obj_id);
   while( obj.tagName != 'BODY' ) {
     result += obj.offsetTop;
     obj = obj.offsetParent;
   }
   return result;
}

function GetAbsoluteLeft(obj_name) {
   var obj;
   var result = 0;
   obj = GetObject(obj_name);
   while( obj.tagName != 'BODY' ) {
     result += obj.offsetLeft;
     obj = obj.offsetParent;
   }
   return result;
}
		
function SetFavorites() {
	window.external.AddFavorite('http://www.trinet.ru', 'Trinet. Интернет-решения, Разработка ПO, Дизайн.')
}



var cur_num = 0;
var timer;
var coord_array = Array(Array(49, 66), Array(50, 150), Array(49, 230));
var menu_link_array = Array('internet.phtml', 'program.phtml', 'design.phtml');

function menu_on(num) {
	clearTimeout(timer);
	if (cur_num != 0) {
		GetObj('menu'+cur_num).src = 'images/menu'+cur_num+'.gif';
	}
	cur_num = num;
	GetObj('menu'+num).src = 'images/menu' + num + '_sel.gif';
	
	GetObj('light').style.top = GetAbsoluteTop('centralheader') + coord_array[num - 1][0];
	GetObj('light').style.left = GetAbsoluteLeft('centralheader') + coord_array[num - 1][1];
	GetObj('light').style.display = '';	
	
	GetObj('main_menu_link').href = '/' + menu_link_array[num - 1];
}

function f_menu_off() {
	GetObj('light').style.display = 'None';
	//GetObj('submenu'+num).style.display = 'None';
	GetObj('menu'+cur_num).src = 'images/menu'+cur_num+'.gif';
}

function menu_off(num) {
	timer = window.setTimeout("f_menu_off("+num+")",250);
}

function submenu_on(num) {
	clearTimeout(timer);
}

function submenu_off(num) {
	timer = window.setTimeout("f_menu_off("+num+")",250);
}

//--------------------------------// Get Splitted Link
function GetLink(splited_link,target) {
	newlink = unescape(splited_link).replace(/\|/g,"");
	if(!target || target == 1) {
		newwin = window.open(newlink,"_blank","toolbar=1,scrollbars=1,status=1,location=1,menubar=1,resizable=1,personalbar=1");
		if (newwin) {
			newwin.focus();
		}
	} else {
		window.location = newlink;
	}
}

//--------------------------------// Browsers
opera = (window.opera) ? true : false;
ie = (document.all && !opera) ? true : false;

var version = 6;
var flash = false;
if (navigator.plugins) {
	if(navigator.plugins["Shockwave Flash"]) {
		plugin = navigator.plugins["Shockwave Flash"].description;
		flash = parseInt(plugin.charAt(plugin.indexOf('.') - 1)) >= version;
	} else {
		if ((navigator.userAgent.indexOf('MSIE') != -1)&&(navigator.userAgent.indexOf('Win') != -1)) {
		  	var vb = '<script language="vbscript">\n'
			+ ' on error resume next\n'
			+ ' flash = IsObject(CreateObject('
			+ ' "ShockwaveFlash.ShockwaveFlash.' + version + '"))\n'
			+ '<' + '/script>';
			document.write(vb);
		}
	}
}

//--------------------------------// Print Flash
function PrintFlash(path, wid, heg, pic, lnk, paramz) {
	if(flash){
		document.open();
		document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="6,0,0,0" width="' + wid + '" height="' + heg + '">');
		document.write ('<param name=movie value="' + path + '">');
		document.write ('<param name="quality" value="high">');
		document.write ('<param name="menu" value="false">');
		document.write ('<param name="FlashVars" value="' + paramz + '">');
		document.write ('<embed src="' + path + '" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + wid + '" height="' + heg +'" FlashVars="' + paramz + '" menu="false"></embed>');
  		document.write ('</object>');
		document.close();
	} else {
		document.open();
		if(lnk != '') document.write ('<a href="'+ lnk +'">');
		document.write('<img src="'+ pic +'" width="'+ wid +'" height="'+ heg +'">')
		if(lnk != '') document.write ('</a>');
		document.close();
	}
}

function RemoveImageLinks(obj){
	var i;
	for (i=0;i<obj.childNodes.length;i++){
		if (obj.childNodes[i].nodeName=='IMG'){
			if (obj.childNodes[i].parentNode.nodeName=='A'){
				obj.childNodes[i].parentNode.href = '#';
				obj.childNodes[i].parentNode.style.cursor = 'default';
			}
			return;
		}
		else RemoveImageLinks(obj.childNodes[i]);
	}
}

