// Path to images
var source = "";			//path to files;
var path = source+"images/";//path to images
var type = ".asp";
var dom = "pms.intsoft.spb.ru";

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;

function preloadImages() {
	if (document.images) {
		newImage(path+"sub2_ar-over.gif");
		newImage(path+"sub_ar-over.gif");
		newImage(path+"item_ar-over.gif");
		newImage(path+"item2_ar-over.gif");
		newImage(path+"company_ar-over.gif");
		newImage(path+"download_ar-over.gif");
		preloadFlag = true;
	}
}

// Function getMenuItem - returns table row for main menu Item
// ItemType - may be 'item','item2','company' or 'download' for top level items
//                   'sub2','sub' - for subitems
//  Itemlink - name of HTML document
//  alt      - alt text
//  Sel - currently selected menu item name. For selected item  - Sel = Itemlink

function getMenuItem(ItemType,ItemLink,alt,Sel) {

var onmouseover = 'onmouseover="changeImages(\''+ItemLink+'_ar\', \''+path+ItemType+'_ar-over.gif\'); return true;"\n';
var onmouseout = 'onmouseout="changeImages(\''+ItemLink+'_ar\', \''+path+ItemType+'_ar.gif\'); return true;">\n';

if ((ItemType == 'sub')||(ItemType == 'sub2')) {
	var ItemHeight = 17;
	var column = '<td><img src="'+path+ItemType+'left.gif" width=19 height=17></td>';
	}
else 
	{
	var ItemHeight = 26;
	var column = '<td><img src="'+path+'left.gif" width=19 height='+ItemHeight+'></td>\n';
	}
	
if (ItemType == 'company') column = '<td><img src="'+path+'homeleft.gif" width=19 height='+ItemHeight+'></td><td rowspan=25 bgcolor="#ebebe1"><img src="'+path+'spacer.gif" width=9 height=1></td>\n';
if (ItemType == 'download') column ='<td><img src="'+path+'downloadleft.gif" width=19 height='+ItemHeight+'></td>';
if (ItemType == 'item2') column ='<td><img src="'+path+'item2left.gif" width=19 height='+ItemHeight+'></td>';

var fileext = '.html"\n';
if ((ItemLink == 'news')||(ItemLink == 'management')||(ItemLink == 'offshore')) fileext = '.php"\n';

if (Sel != ItemLink) {
	Item = '<tr><td><a href="' + source + ItemLink + fileext + onmouseover + onmouseout +
	'<img name="'+ItemLink+'_ar" src="'+path+ItemType+'_ar.gif" width=23 height='+ItemHeight+' border=0></a>'+
	'</td><td>\n<a href="' + source + ItemLink + fileext + onmouseover + onmouseout +
	'<img src="' + path + ItemLink + '.gif" width=124 height=' + ItemHeight + ' border=0 alt="' + alt + '"></a></td>\n' +
	column + '</tr>\n';
}
else { // if item is selected
	Item = '<tr><td>'+
	'<img src="'+path+ItemType+'_ar-over.gif" width=23 height='+ItemHeight+' border=0>'+
	'</td><td>\n'+
	'<img src="'+path+ItemLink+'.gif" width=124 height='+ItemHeight+' border=0 alt="'+alt+'"></td>\n'+
	column+
	'</tr>\n';
}
return Item;	
}
	var file = "processmail";
	var path2 = "/_proceedmail/";
function draw_MainMenu(Sel){
	toplogo = '<table border=0 cellpadding=0 cellspacing=0><tr><td colspan=4><img border=0 src="'+path+'toplogo.gif" width=175 height=115></td></tr>';
	bottomlogo = '<tr><td colspan=3><img src="'+path+'bottom_logo.gif" width=166 height=172></td><td  bgcolor="#ebebe1"><img src="'+path+'spacer.gif" width=9 height=1></td></tr></table>';
	separator = '<tr><td colspan=3><img src="'+path+'narezka_last_67.gif" width=166 height=1></td></tr>';

	company = getMenuItem("company","index","about company",Sel);
	profile = getMenuItem("sub2","profile","profile",Sel);
	news = getMenuItem("sub","news","company news",Sel);
	clients = getMenuItem("sub","clients","our clients",Sel);
	management = getMenuItem("item","management","project management",Sel);
	online = getMenuItem("sub2","online","online project management system",Sel);
	warranties = getMenuItem("sub","warranties","procedures and warranties",Sel);
	software = getMenuItem("item","software","software deparment",Sel);
	expertise = getMenuItem("sub2","expertise","expertise",Sel);
	prolog = getMenuItem("sub","prolog","prolog technology",Sel);
	projects = getMenuItem("sub","projects","implemented projects",Sel);
	web = getMenuItem("item","web","web design",Sel);
	services = getMenuItem("sub2","services","services",Sel);
	portfolio = getMenuItem("sub","portfolio","portfolio",Sel);
	human = getMenuItem("item","human","human resources",Sel);
	recruitment = getMenuItem("sub2","recruitment","recruitment policy",Sel);
	vacancies = getMenuItem("sub","vacancies","vacancies",Sel);
	business = getMenuItem("item","business","business model",Sel);
	pricing = getMenuItem("sub2","pricing","pricing models",Sel);
	rates = getMenuItem("sub","rates","rates and payments",Sel);
	communication = getMenuItem("sub","communication","communication",Sel); 
	offshore = getMenuItem("item","offshore","offshore development",Sel);
	faq = getMenuItem("sub2","faq","FAQs",Sel);
	articles = getMenuItem("sub","articles","articles",Sel);
	testimonials = getMenuItem("item","testimonials","testimonials",Sel);
	contact = getMenuItem("item2","contact","contact us",Sel);
	postproject = getMenuItem("sub2","postproject","post your project",Sel);
	downloads = getMenuItem("download","downloads","downloads",Sel);

	menu = toplogo + company + profile + news + clients + management + online  +  warranties  + software  + expertise 
		+ prolog + projects+ web + services + portfolio	+  human + recruitment + vacancies + business
		+ pricing + rates + communication + offshore + faq + articles + testimonials + separator 
		+ contact + postproject + downloads + bottomlogo;
	return menu;
}

function drawMenu(itemSel){
var Adv = '';

if ((itemSel == 'index')||(itemSel == 'warranties')) 
Adv =	'<p>&nbsp;</p>' +
		'<p>&nbsp;</p>' +
		'<p><br><br>&nbsp;&nbsp;&nbsp;Listed in the:' +
		'  <ul><li><a href="http://www.outsourcingindex.com/external.htm" target="_blank">Outsourcing Index</a></li>' +
		'      <li><a href="http://www.dotnetspider.com/offshore/36-Intelligence-Soft.aspx" target="_blank">DotNetSpider.com</a></li>' +
		'  </ul>';

if ((itemSel == 'online')||(itemSel == 'faq')) 
Adv =	'<p>&nbsp;</p>' +
		'<p>&nbsp;</p>' +
		'<a href="http://www.tradeboss.com/?source=bizkeywords&bizkeywordid=2036" target="_blank"><img border=0 src="http://www.tradeboss.com/banners/tradeholdingpartner_120x60.gif"></a>';

if (itemSel == 'offshore') 
 Adv =	'<p>&nbsp;</p>' +
		'<table border=1 cellspacing=0 cellpadding=5 width=156px><tr><td><i>' +
		'<p align=left><a href="http://www.enterblog.com" target="_blank">Offshore Outsourcing World</a> - daily news magazine focused on offshore outsourcing</p>' +
		'</i></td></tr></table>' +
		'<br>' +
		'<table border=1 cellspacing=0 cellpadding=24 width=156><tr><td>' +
		'<a href="http://www.ardinsoftware.fi" target="_blank"><img src="banners/banner-ardin.gif" border=0 alt="Ardin ' +
		'Software Oy is a Finnish provider of software outsourcing services. Being a partner of 30+ IT companies ' +
		'in Russia and CIS, Ardin is a one-stop shopping place for fulfilling your software needs."></a>' +
		'</td></tr></table>';

if (itemSel == 'articles') 
Adv =	'<p>&nbsp;</p>' +
		'<table bgcolor="#D7DDCC" style="border-style:solid; border-color:#8DAE9F; border-width:2" ' +
		' cellspacing=0 cellpadding=5 width=160px onclick="document.location.href=\'profile.html\'"><tr><td>' +
		'<p><i>' +
		'Since 1994 Russian software development company Intelligence-Soft operates in global outsourcing ' +
		'market providing its clients with reasonably priced services in various areas of IT.<br>Why did a number of ' +
		'Western companies choose Intelligence-Soft as a vendor?</i><br>' + 
		'<a href="profile.html">' +
		'Click here...' +
		'</a>' +
		'</p></td></tr></table>' +
		'<p>&nbsp;</p>' +
		'<table bgcolor="#D7DDCC" style="border-style:solid; border-color:#8DAE9F; border-width:2" ' +
		'cellspacing=0 cellpadding=5 width=160px onclick="document.location.href=\'pricing.html\'"><tr><td><p><i>' +
		'After reading this article take an opportunity of visiting our web page explaining various business models ' +
		'used by Intelligence-Soft in the relations with its customers.</i><br>' + 
		'<a href="pricing.html">' +
		'Click here...' +
		'</a>' +
		'</p></td></tr></table>';

topTable = '<a href="#Top"></a>'+
'<table border=0 cellpadding=0 cellspacing=0><tr>'+
	'<td valign=top>'+
		'<table border=0 cellpadding=0 cellspacing=0><tr>'+
			'<td valign=top>'+
				draw_MainMenu(itemSel)+ Adv +
				'</td>'+
			'<td valign=top>'+
				'<table border=0 cellpadding=0 cellspacing=0><tr><td><img border=0 src="'+path+'top.gif" width=574 height=80></td></tr></table>'+
				'<table border=0 cellpadding=0 cellspacing=0 width=565><tr>'+
					'<td>';
return topTable;
}
	var action = "http://" + dom + path2 + file + type;
function drawBottom(){
	bottomTable = 		'</td></tr>'+
					'</table>'+
					'<map name="bottom">'+
					'<area alt="back" coords="0,0,44,15" href="javascript:history.back()" shape=rect>'+
					'<area alt="home" coords="264,0,320,15" href="' + source + 'index.html">'+
					'<area alt="top" coords="525,0,571,15" href="#Top"></map>'+
					'<img src="'+source+'titles/bottomline.gif" width=565 height=15 border=0 vspace=10 usemap="#bottom">'+
					'<center><p class="cr">&copy;2001, 2009 <a style="text-decoration:none" href="http://www.intsoft.spb.ru/">Intelligence-Soft, Ltd.</a></p></center>'+
				'</td></tr>'+
			'</table>'+
		'</td>'+
	//	'<td valign="top">Google</td>'+
	  '</tr>'+
	'</table>';
	return bottomTable;
}

function show_addr_2(Prefix,Suffix,Text,Replace) {
	var addr = Prefix + '@' + Suffix;
	var html = '<A href="mailto:' + addr + '"';
	var displaytext = Text;
	if (Text == '')
		displaytext = addr;
	if (Replace)
	{
		html += ' onmousemove="window.status=\'Send e-mail message to ' + displaytext + '\'"';
		html += ' onmouseout="window.status=\'\'"';
	}
	html += '>' + displaytext + '</A>';
return html;
}

function validate(Frm) {
	if (Frm.name.value == "") {
		alert("Please enter your name.");
		Frm.name.focus();
		return false;
	}
	if (Frm.replyemail.value == "") {
		alert("Please enter your e-mail address.");
		Frm.replyemail.focus();
		return false;
	}
	var re = /^(([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*)|(\".+\"))@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)*(\.[a-zA-Z]{2,6})$/gi
	if (Frm.replyemail.value.match(re) == null) {
		alert("Wrong e-mail address format. Please correct.");
		Frm.replyemail.focus();
		Frm.replyemail.select();
		return false;
	}
	Frm.action = action;
	Frm.method = "post";
	return true;
}
