/**
 * @author RCC
 */

function outputHeader() {
	if (document) {
		outputTopAnchor();
		document.writeln('<div id="header">');
		document.writeln('<div class="logoitc"><span>&lt;RCC&gt; IT Услуги</span></div>');
		document.writeln('</div>');
		document.writeln('<div id="nav">');
		document.writeln('<ul>');
		document.writeln('<li><a href="about_us.htm" id="about" title="Научете повече за RCC Solutions"><span>Кои сме ние?</span></a></li>');
		document.writeln('<li><a href="services_1.htm" id="services" title="Прегледайте услугите, които предлагаме"><span>Услуги</span></a></li>');
		document.writeln('<li><a href="products.htm" id="portfolio" title="Прегледайте нашите продукти"><span>Продукти</span></a></li>');
			
		document.writeln('<li><a href="customers.htm" id="customers" title="Научете повече за нашите клиенти"><span>Клиенти</span></a></li>');
		document.writeln('<li><a href="contact_us.htm" id="contact" title="Не се притеснявайте да ни потърсите"><span>Контакти</span></a></li>');
		
		document.writeln('<li><a href="' + window.location.href.replace('/bg/', '/en/') + '" id="lang" title="English version"><span>English</span></a></li>');
		
		// added by ZA:		
		/*
		var href = window.location.href;
		var redirect = "";
		var isBG = href.indexOf("/bg/");
		if (isBG > 0)
		{
			redirect = '<img src="../img/bg_flag.jpg" title="Български" class="language" />&nbsp;<a href="'+href.replace('/bg/','/en/')+'" id="lang"><img src="../img/en_flag.jpg" title="English" class="language" /></a></span>';
		}
		else
		{
			redirect = '<a href="'+href.replace('/en/','/bg/')+'" id="lang"><img src="../img/bg_flag.jpg" title="Български" class="language" /></a>&nbsp;<img src="../img/en_flag.jpg" title="English" class="language" />';
		}
		
		document.writeln('<li>' + redirect + '</li>');
		*/
		//----------------
		
		document.writeln('</ul>');
		document.writeln('</div>');
	}
}

function outputFooter() {
	if (document) {
		document.writeln('<div id="footer">');
		document.writeln('	<span>© 2009, RCC Solutions Limited. All rights reserved.</span>');
		document.writeln('</div>');
	}
}

function outputTopAnchor() {
	document.writeln("<a id=\"aTop\"></a>");
}

function outputBackToTopLink() {
	document.writeln("<a href=\"#aTop\">Обратно горе</a>")
}

function clearMenuSelection() {
	if (document.getElementById) {
		_doc = document;
		if (_doc.getElementById("about") && _doc.getElementById("about").parentNode) {
			_doc.getElementById("about").parentNode.className = "";			
		}
		if (_doc.getElementById("services") && _doc.getElementById("services").parentNode) {
			_doc.getElementById("services").parentNode.className = "";
		}
		if (_doc.getElementById("portfolio") && _doc.getElementById("portfolio").parentNode) {
			_doc.getElementById("portfolio").parentNode.className = "";
		}
		if (_doc.getElementById("customers") && _doc.getElementById("customers").parentNode) {
			_doc.getElementById("customers").parentNode.className = "";
		}
		if (_doc.getElementById("contact") && _doc.getElementById("contact").parentNode) {
			_doc.getElementById("contact").parentNode.className = "";
		}
	}
	/* 
	if (parent && parent.frames && parent.frames["headerFrame"]) {
		_frm = parent.frames["headerFrame"];
		if (_frm.document && _frm.document.getElementById) {
			_doc = _frm.document;
			if (_doc.getElementById("about") && _doc.getElementById("about").parentNode) {
				_doc.getElementById("about").parentNode.className = "";			
			}
			if (_doc.getElementById("services") && _doc.getElementById("services").parentNode) {
				_doc.getElementById("services").parentNode.className = "";
			}
			if (_doc.getElementById("portfolio") && _doc.getElementById("portfolio").parentNode) {
				_doc.getElementById("portfolio").parentNode.className = "";
			}
			if (_doc.getElementById("customers") && _doc.getElementById("customers").parentNode) {
				_doc.getElementById("customers").parentNode.className = "";
			}
			if (_doc.getElementById("contact") && _doc.getElementById("contact").parentNode) {
				_doc.getElementById("contact").parentNode.className = "";
			}
		}
	}
	*/
}

function selectRootMenuItem(_root) {
	//clearMenuSelection();
	if (document.getElementById) {
		_elem = document.getElementById(_root);
		if (_elem && _elem.parentNode) {
			_elem.parentNode.className = "current";
		}
	}
	/*
	_frm = parent.frames.headerFrame;
	if (_frm && _frm.document && _frm.document.getElementById) {
		_elem = _frm.document.getElementById(_root);
		if (_elem && _elem.parentNode) {
			_frm.document.getElementById(_root).parentNode.className = "current";
		}
	}
	*/
}

function handleContentResize() {
	if (document.getElementById) {
		_divContent = document.getElementById("content");
		_divMain = document.getElementById("main");
		_body = document.body;
		_wMain = _body.offsetWidth - 30;
		_wContent = _wMain - 264 - 54;
		//alert(_wMain);
		try {
			_divContent.style.width=_wContent + "px;";
			_divMain.style.width = _wMain + "px;";
		} catch (err) {
			try {
				_divContent.style.width=_wContent;
				_divMain.style.width = _wMain;
			} catch (err) {
				//do nothing
			}
		}
	}
}

function popupWindow (url, windowname) {
	wnd = window.open(url, windowname, "resizable=1,scrollbars=1");
}
