var livescreenHeight=screen.availHeight;
var livescreenWidth=screen.availWidth;

var windowWidth;
var minWidth=761;
var maxWidth=982;
var CheckWidth=965;

function LivePageHeight() {
 if (window.innerHeight != null)
  return window.innerHeight;
 if (document.body.clientHeight != null)
  return document.body.clientHeight;
 return screen.availHeight;
}

function LivePageWidth() {
 if (window.innerWidth!= null)
  return window.innerWidth;
 if (document.body.clientWidth!= null)
  return document.body.clientWidth;
 return screen.availWidth;
}

function ShowTop(){
  if (LivePageWidth() > CheckWidth) { 
   document.write('<TR><TD width="235" height="20" bgcolor="#99D2E3"><IMG src="img/pics01a.jpg" width="235" height="20" /></TD>');
   document.write('<TD width="100%" height="20" colspan=2 bgcolor="#D7F3F7" nowrap background="img/pics02a.jpg" style="background-repeat: no-repeat;">');
   document.write('<IMG src="img/0.gif" width=493 height=1 align=left><IMG src="img/design-top.gif" width=104 height=20></TD></TR>');
  }
}

function ShowTop2_1(){
  if (LivePageWidth() > CheckWidth) { 
   document.write('<DIV style="height:20px;"><IMG src="img/pics01a.jpg" width="235" height="20" /></DIV></TD>');
  }
}

function ShowTop2_2(){
  if (LivePageWidth() > CheckWidth) { 
   document.write('<TD width="100%" colspan=2 bgcolor="#D7F3F7" nowrap style="background-image: url(\'img/pics02a.jpg\'); background-repeat: no-repeat;"><DIV style="height: 20px;"><IMG src="img/0.gif" width=493 height=1 align=left><IMG src="img/design-top.gif" width=104 height=20></DIV>');
  }
}

function ShowTop2(){
  if (LivePageWidth() > CheckWidth) { 
   document.write('<IMG src="img/0.gif" width=493 height=1 align=left><IMG src="img/design-top2.gif" width=104 height=14>');
  }
}

function ShowName(){
  document.write('<DIV id=alierra style="');
  if (LivePageWidth() > CheckWidth) { document.write('top: 176px;">');}
  else { document.write('top: 157px;">');}
  document.write('<IMG src="img/alierra.gif" width="122" height="16" alt="Alierra Web Design Development Company" /></DIV>');
  document.write('<DIV id=logo style="');
  if (LivePageWidth() > CheckWidth) { document.write('top: 76px;">');}
  else { document.write('top: 56px;">');}
  document.write('<IMG src="img/butterfly.gif" width="55" height="51" alt="Alierra Web Design Development Company" /></DIV>');
}


function ShowHead() {
var objHead = document.getElementById("Head");
 if (LivePageWidth() > CheckWidth) { 
  objHead.style.backgroundImage='url("img/headbg.jpg")';
  document.write('<IMG src="img/pic_2x.jpg" width="120" height="124" alt="" />');
  document.write('<IMG src="img/pic_3x.jpg" width="123" height="124" alt="" />');
  document.write('<IMG src="img/pic_4x.jpg" width="129" height="124" alt="" />');
  document.write('<IMG src="img/pic_5x.jpg" width="132" height="124" alt="" />');
  document.write('<IMG src="img/pic_6x.jpg" width="131" height="124" alt="" />');
  document.write('<IMG src="img/pic_7x.jpg" width="130"  height="124" alt="" />');
 }
 else {
  document.write('<IMG src="img/pic_2.jpg" width="243" height="124" alt="" />');
  document.write('<IMG src="img/pic_3.jpg" width="261" height="124" alt="" />');
  document.write('<IMG src="img/pic_4.jpg" width="261" height="124" alt="" />');
 }
}

function ShowVault() {
  if (LivePageWidth() > CheckWidth) {
	document.write('<TABLE width="730" height="42" border="0" cellpadding="0" cellspacing="0" bgcolor="#E7F5F9"><TR>');
	document.write('<TD width="47" height="42" rowspan="2"><IMG src="img/leftbt_x.gif" width="47" height="42" alt="" /></TD>');
	document.write('<TD width="636" height="7"><IMG src="img/topbt.gif" width="636" height="7" alt="" /></TD>');
	document.write('<TD width="47" height="42" rowspan="2"><IMG src="img/rightbt_x.gif" width="47" height="42" alt="" /></TD></TR>');
	document.write('<TR><TD height="35" align=center>');
	} 
/* 800*600 */
  else {
	document.write('<TABLE width="490" height="50" border="0" cellpadding="0" cellspacing="0" bgcolor="#E7F5F9"><TR>');
	document.write('<TD width="55" height="50" rowspan="2"><IMG src="img/leftbt.gif" width="55" height="50" alt="" /></TD>');
	document.write('<TD width="380" height="7"><IMG src="img/topbt.gif" width="380" height="7" alt="" /></TD>');
	document.write('<TD width="55" height="50" rowspan="2"><IMG src="img/rightbt.gif" width="55" height="50" alt="" /></TD></TR>');
	document.write('<TR><TD height="43" align=center>');
	} 
}

function ShowVaultEnd() {
document.write('</TD></TR></TABLE>');
}

function CalcWidth() {
var objTD = document.getElementById("CalcWidth");
  if (LivePageWidth() > CheckWidth)  { txtwidth='750'; }  else { txtwidth='520'; }
  //document.write('<TD width='+txtwidth+' height=100% valign=top class=center>');
  objTD.width=eval(txtwidth); 
}

/* preload images for Rollover menu items */
function Preload () {
var objH = new Image;
 objH.src='img/mnu/home_o.jpg';
var objW = new Image;
 objW.src='img/mnu/web-design_o.jpg';
var objS = new Image;
 objS.src='img/mnu/seo-promotion_o.jpg';
var objT = new Image;
 objT.src='img/mnu/hosting_o.jpg';
var objP = new Image;
 objP.src='img/mnu/pricing_o.jpg';
var objF = new Image;
 objF.src='img/mnu/portfolio_o.jpg';
var objA = new Image;
 objA.src='img/mnu/about_o.jpg';
var objC = new Image;
 objC.src='img/mnu/contact_o.jpg';
var objK = new Image;
 objC.src='img/mnu/consulting_o.jpg';
}

/*
originally written by paul sowden <paul@idontsmoke.co.uk> | http://idontsmoke.co.uk
modified and localized by alexander shurkayev <alshur@narod.ru> | http://htmlcoder.visions.ru
*/

window.onerror = null;

tooltip = {

	/* НАЧАЛО НАСТРОЕК */

	attr_name: "tooltip", // наименование создаваемого tooltip'ого атрибута
	blank_text: "", // текст для ссылок с target="_blank"
	newline_entity: "  ", // укажите пустую строку (""), если не хотите использовать в tooltip'ах многострочность; ежели хотите, то укажите тот символ или символы, которые будут заменяться на перевод строки
	max_width: 0, // максимальная ширина tooltip'а в пикселах; обнулите это значение, если ширина должна быть нелимитирована
	delay: 500, // задержка при показе tooltip'а в миллисекундах
	
	/* КОНЕЦ НАСТРОЕК */

	t: document.createElement("DIV"),
	c: null,
	g: false,

	m: function(e){
		if (tooltip.g){
			oCanvas = document.getElementsByTagName(
			(document.compatMode && document.compatMode == "CSS1Compat") ? "HTML" : "BODY"
			)[0];
			x = window.event ? event.clientX + oCanvas.scrollLeft : e.pageX;
			y = window.event ? event.clientY + oCanvas.scrollTop : e.pageY;
			tooltip.a(x, y);
		}
	},

	d: function(){
		tooltip.t.setAttribute("id", "tooltip");
		//tooltip.t.style.filter = "alpha(opacity=85)"; // buggy in ie5.0
		document.body.appendChild(tooltip.t);
		a = document.all ? document.all : document.getElementsByTagName("*");
		aLength = a.length;
		for (var i = 0; i < aLength; i++){

			//if (a[i].tagName == "A" || a[i].tagName == "BUTTON" || (a[i].tagName == "INPUT" && (a[i].type == "submit" || a[i].type == "button" || a[i].type == "reset"))) a[i].onclick = self.focus;

			if (!a[i]) continue;

			tooltip_title = a[i].getAttribute("title"); // returns form object if IE & name="title"; then IE crashes; so...
			if (tooltip_title && typeof tooltip_title != "string") tooltip_title = "";

			tooltip_alt = a[i].getAttribute("alt");
			tooltip_blank = a[i].getAttribute("target") && a[i].getAttribute("target") == "_blank" && tooltip.blank_text;
			if (tooltip_title || tooltip_blank){
				a[i].setAttribute(tooltip.attr_name, tooltip_blank ? (tooltip_title ? tooltip_title + " " + tooltip.blank_text : tooltip.blank_text) : tooltip_title);
				if (a[i].getAttribute(tooltip.attr_name)){
					a[i].removeAttribute("title");
					if (tooltip_alt && a[i].complete) a[i].removeAttribute("alt");
					tooltip.l(a[i], "mouseover", tooltip.s);
					tooltip.l(a[i], "mouseout", tooltip.h);
				}
			}else if (tooltip_alt && a[i].complete){
				a[i].setAttribute(tooltip.attr_name, tooltip_alt);
				if (a[i].getAttribute(tooltip.attr_name)){
					a[i].removeAttribute("alt");
					tooltip.l(a[i], "mouseover", tooltip.s);
					tooltip.l(a[i], "mouseout", tooltip.h);
				}
			}
			if (!a[i].getAttribute(tooltip.attr_name) && tooltip_blank){
				//
			}
		}
		document.onmousemove = tooltip.m;
		window.onscroll = tooltip.h;
		tooltip.a(-99, -99);
	},

	s: function(e){
		d = window.event ? window.event.srcElement : e.target;
		if (!d.getAttribute(tooltip.attr_name)) return;
		s = d.getAttribute(tooltip.attr_name);
		if (tooltip.newline_entity){
			s = s.replace(/\&/g,"&amp;");
			s = s.replace(/\</g,"&lt;");
			s = s.replace(/\>/g,"&gt;");
			s = s.replace(eval("/" + tooltip.newline_entity + "/g"), "<br />");
			tooltip.t.innerHTML = s;
		}else{
			if (tooltip.t.firstChild) tooltip.t.removeChild(tooltip.t.firstChild);
			tooltip.t.appendChild(document.createTextNode(s));
			//tooltip.t.innerText = s;
		}
		tooltip.c = setTimeout("tooltip.t.style.visibility = 'visible';", tooltip.delay);
		tooltip.g = true;
	},

	h: function(e){
		tooltip.t.style.visibility = "hidden";
		if (!tooltip.newline_entity && tooltip.t.firstChild) tooltip.t.removeChild(tooltip.t.firstChild);
		clearTimeout(tooltip.c);
		tooltip.g = false;
		tooltip.a(-99, -99);
	},

	l: function(o, e, a){
		if (o.addEventListener) o.addEventListener(e, a, false); // was true--Opera 7b workaround!
		else if (o.attachEvent) o.attachEvent("on" + e, a);
			else return null;
	},

	a: function(x, y){
		oCanvas = document.getElementsByTagName(
		(document.compatMode && document.compatMode == "CSS1Compat") ? "HTML" : "BODY"
		)[0];
		
		w_width = oCanvas.clientWidth ? oCanvas.clientWidth + oCanvas.scrollLeft : window.innerWidth + window.pageXOffset;
		w_height = window.innerHeight ? window.innerHeight + window.pageYOffset : oCanvas.clientHeight + oCanvas.scrollTop; // should be vice verca since Opera 7 is crazy!

		tooltip.t.style.width = ((tooltip.max_width) && (tooltip.t.offsetWidth > tooltip.max_width)) ? tooltip.max_width + "px" : "auto";
		
		t_width = tooltip.t.offsetWidth;
		t_height = tooltip.t.offsetHeight;

		tooltip.t.style.left = x + 8 + "px";
		tooltip.t.style.top = y + 8 + "px";
		
		if (x + t_width > w_width) tooltip.t.style.left = w_width - t_width + "px";
		if (y + t_height > w_height) tooltip.t.style.top = w_height - t_height + "px";
	}
}

var root = window.addEventListener || window.attachEvent ? window : document.addEventListener ? document : null;
if (root){
	if (root.addEventListener) root.addEventListener("load", tooltip.d, false);
	else if (root.attachEvent) root.attachEvent("onload", tooltip.d);
}
