﻿	function drawcolor(imgid, path, objectidinformation)
{
		document.getElementById(imgid).src = path;
		document.getElementById("hidsubject").value = objectidinformation;
	}
	function setlanguage(lnid)
	{
		if (lnid==2)
		{
			document.getElementById("hlnid").value="2";
			document.getElementById("tdlanguagebar").innerHTML="<table width='100%' height='30' border='0' cellpadding='0' cellspacing='0'><tr><td width='60' align='center'>&nbsp;</td><td width='25' align='center' class='MenuSection'>Հայ</span></td><td width='25' align='center' bgcolor='#000000' class='TopMenu'><a href='javascript:setlanguage(2);'>РУС</a></td><td width='25' align='center' class='MenuSection'><a href='javascript:setlanguage(3);'>EN</a></td><td width='35' align='center'>&nbsp;</td><td width='700' align='center'><table width='700' border='0' align='left' cellpadding='0' cellspacing='0'><tr><td width='25' height='14' align='center'>&nbsp;</td><td width='121' align='left'><a href='javascript:showabout(\"abouthtml\")' class='MenuSection'>О компании</a></td><td width='147' align='left'><a href='javascript:showabout(\"productionhtml\")' class='MenuSection'>Производство</a></td><td width='155' align='left'><a href='javascript:showabout(\"buidinghtml\")' class='MenuSection'>Строительство</a></td><td width='140' align='left'><a href='javascript:showabout(\"portfoliohtml\")' class='MenuSection' >Наши работы</a></td><td width='117' align='left'><a href='javascript:showabout(\"materialshtml\")' class='MenuSection' >Материалы</a></td><td width='62' align='left'><a href='javascript:showabout(\"contactshtml\")' class='MenuSection' >Контакты</a></td></tr></table></td></tr></table>";
			document.getElementById("MenuSection1").innerHTML="&nbsp;ДВЕРИ";
		    document.getElementById("MenuSection2").innerHTML="&nbsp;ОКНА";
			document.getElementById("MenuSection3").innerHTML="&nbsp;МЕБЕЛЬ";
		    document.getElementById("lnk1").innerHTML="Деревянные";
			document.getElementById("lnk2").innerHTML="Шпон-деревянные";
		    document.getElementById("lnk4").innerHTML="Металлопластные";
			document.getElementById("lnk5").innerHTML="Алюминневые";
			
		   	document.getElementById("lnk6").innerHTML="Деревянные";
		    document.getElementById("lnk7").innerHTML="Металлопластные";
			document.getElementById("lnk8").innerHTML="Алюминневые";
		    document.getElementById("lnk9").innerHTML="Каталог мебели";
		    
		    document.getElementById("dvfooter").innerHTML="<table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color: #FE7C00;' class='BottomMenu'><tr><td width='236' height='30' align='left' valign='top' bgcolor='#000000'>© 2008 ООО 'ЛУПУС'.  Все права защищены.</td><td width='560' align='center' valign='top' bgcolor='#000000'><a href='javascript:showabout(\"abouthtml\")' >О компании</a> | <a href='javascript:showabout(\"productionhtml\")'> Производство</a> | <a href='javascript:showabout(\"buidinghtml\")'>Строительство</a> | <a href='javascript:showabout(\"portfoliohtml\")'>Наши работы</a> | <a href='javascript:showabout(\"materialshtml\")'>Материалы</a> | <a href='javascript:showabout(\"contactshtml\")'>Контакты</a></td><td width='182' align='center' valign='top' bgcolor='#000000'><span class='style6'>+(374231) 4-04-08, 4 04 06</span></td></tr></table>";
		   /* document.getElementById("newstd").innerHTML="<table border='0' cellpadding='0' cellspacing='0' width='100%' style='background: url(/img/volhovec_done_19.gif);'><tr><td  align='left' style='background: url(/img/volhovec_done_17-1.gif) no-repeat;'><br><br><br><div id='dvplaceholder'></div><br><br><a href='javascript:showabout(\"abouthtml\")' ><img src='images/photos/iso.jpg' width='238' height='330' /></a><br><br></td></tr></table></p></td></tr></table>";*/
		    if (document.getElementById("hidflashrender").value=="0")
 			{
		    document.getElementById("spmaintext").innerHTML="<br>Компания «ЛУПУС» работает на армянском рынке рынке межкомнатных и входных дверей с 2002 года и в настоящее время стала одним из крупнейших производителей высококачественных деревянных и металопластных дверей и окон.<a href='javascript:showabout(\"abouthtml\")'>Подробнее</a>";
			}
	    }
		else if(lnid==1)
		{
		document.getElementById("tdlanguagebar").innerHTML="<table width='100%' height='30' border='0' cellpadding='0' cellspacing='0'><tr><td width='60' align='center'>&nbsp;</td><td width='25' align='center' class='TopMenu' bgcolor='#000000'><a href='javascript:setlanguage(1);'>Հայ</a></span></td><td width='25' align='center' class='MenuSection'><a href='javascript:setlanguage(2);'>РУС</a></td><td width='25' align='center' class='MenuSection'><a href='javascript:setlanguage(3);'>EN</a></td><td width='35' align='center'>&nbsp;</td><td width='700' align='center'><table width='700' border='0' align='left' cellpadding='0' cellspacing='0'><tr><td width='25' height='14' align='center'>&nbsp;</td><td width='121' align='left'><a href='javascript:showabout(\"abouthtml\")' class='MenuSection'>Մեր Մասին</a></td><td width='147' align='left'><a href='javascript:showabout(\"productionhtml\")' class='MenuSection'>Արտադրություն</a></td><td width='155' align='left'><a href='javascript:showabout(\"buidinghtml\")' class='MenuSection'>Շինարարություն</a></td><td width='140' align='center'><a href='javascript:showabout(\"portfoliohtml\")' class='MenuSection' >Մեր Աշխատանքները</a></td><td width='117' align='center'><a href='javascript:showabout(\"materialshtml\")' class='MenuSection' >Հումք</a></td><td width='62' align='left'><a href='javascript:showabout(\"contactshtml\")' class='MenuSection'>Կապ</a></td></tr></table></td></tr></table>";
		    document.getElementById("MenuSection1").innerHTML="&nbsp;Դռներ";
			document.getElementById("MenuSection2").innerHTML="&nbsp;Պատուհաններ";
		    document.getElementById("MenuSection3").innerHTML="&nbsp;Կահույք";
		    document.getElementById("lnk1").innerHTML="Փայտե";
		    document.getElementById("lnk2").innerHTML="Փայտե շպոն";
		    document.getElementById("lnk4").innerHTML="Մետաղապլաստե";
		    document.getElementById("lnk5").innerHTML="Ալյումինե";
		    document.getElementById("lnk6").innerHTML="Փայտե";
		    document.getElementById("lnk7").innerHTML="Մետաղապլաստե";
		    document.getElementById("lnk8").innerHTML="Ալյումինե";
		    document.getElementById("lnk9").innerHTML="Կահույքի հավաքածու";
			document.getElementById("dvfooter").innerHTML="<table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color: #FE7C00;' class='BottomMenu'><tr><td width='236' height='30' align='left' valign='top' bgcolor='#000000'>© 2008 ООО 'ԼՈՒՊՈՒՍ'.  Все права защищены.</td><td width='560' align='center' valign='top' bgcolor='#000000'><a href='javascript:showabout(\"abouthtml\")' >Մեր Մասին</a> | <a href='javascript:showabout(\"productionhtml\")'> Արտադրություն</a> | <a href='javascript:showabout(\"buidinghtml\")'>Շինարարություն</a> | <a href='javascript:showabout(\"portfoliohtml\")'>Մեր Աշխատանքները</a> | <a href='javascript:showabout(\"materialshtml\")'>Հումք</a> | <a href='javascript:showabout(\"contactshtml\")'>Կապ</a></td><td width='182' align='center' valign='top' bgcolor='#000000'><span class='style6'>+(374231) 4-04-08, 4 04 06</span></td></tr></table>";
		  /*  document.getElementById("newstd").innerHTML="<table border='0' cellpadding='0' cellspacing='0' width='100%' style='background: url(/img/volhovec_done_19.gif);'><tr><td  align='left' style='background: url(/img/volhovec_done_17-1.gif) no-repeat;'><br><br><br><div id='dvplaceholder'></div><br><br><a href='javascript:showabout(\"abouthtml\")' ><img src='images/photos/iso.jpg' width='238' height='330' /></a><br><br></td></tr></table></p></td></tr></table>";*/
		    if (document.getElementById("hidflashrender").value=="0")
		    {
		        document.getElementById("spmaintext").innerHTML="any text hay";
		        document.getElementById("paragnews").innerHTML="Novfgdfgfdginki";
		    }
		}
		else if(lnid==3)
		{
		    document.getElementById("hlnid").value="3";
			document.getElementById("tdlanguagebar").innerHTML="<table width='100%' height='30' border='0' cellpadding='0' cellspacing='0'><tr><td width='60' align='center'>&nbsp;</td><td width='25' align='center' class='MenuSection'>Հայ</span></td><td width='25' align='center' class='MenuSection'><a href='javascript:setlanguage(2);'>РУС</a></td><td width='25' align='center' bgcolor='#000000' class='TopMenu'><a href='javascript:setlanguage(3);'>EN</a></td><td width='35' align='center'>&nbsp;</td><td width='700' align='center'><table width='700' border='0' align='left' cellpadding='0' cellspacing='0'><tr><td width='25' height='14' align='center'>&nbsp;</td><td width='150' align='left'><a href='javascript:showabout(\"abouthtml\")' class='MenuSection'>About the company</a></td><td width='100' align='left'><a href='javascript:showabout(\"productionhtml\")' class='MenuSection'>Production</a></td><td width='120' align='left'><a href='javascript:showabout(\"buidinghtml\")' class='MenuSection'>Construction</a></td><td width='100' align='left'><a href='javascript:showabout(\"portfoliohtml\")' class='MenuSection' >Our works</a></td><td width='90' align='left'><a href='javascript:showabout(\"materialshtml\")' class='MenuSection' >Materials</a></td><td width='62' align='left'><a href='javascript:showabout(\"contactshtml\")' class='MenuSection' >Contacts</a></td></tr></table></td></tr></table>";
			document.getElementById("MenuSection1").innerHTML="&nbsp;DOORS";
		    document.getElementById("MenuSection2").innerHTML="&nbsp;WINDOWS";
		    document.getElementById("MenuSection3").innerHTML="&nbsp;FURNITURE";
		    document.getElementById("lnk1").innerHTML="Wooden";
		    document.getElementById("lnk2").innerHTML="Veneer sheet";
		    document.getElementById("lnk4").innerHTML="Metal-Plastic";
		    document.getElementById("lnk5").innerHTML="Aluminium";
		    document.getElementById("lnk6").innerHTML="Wooden";
		    document.getElementById("lnk7").innerHTML="Metal-Plastic";
		    document.getElementById("lnk8").innerHTML="Aluminium";
		    document.getElementById("lnk9").innerHTML="Furniture catalog";
		    document.getElementById("dvfooter").innerHTML="<table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color: #FE7C00;' class='BottomMenu'><tr><td width='236' height='30' align='left' valign='top' bgcolor='#000000'>© 2008 LUPUS LTD. All rights reserved.</td><td width='560' align='center' valign='top' bgcolor='#000000'><a href='javascript:showabout(\"abouthtml\")' >About the company</a> | <a href='javascript:showabout(\"productionhtml\")'>Production</a> | <a href='javascript:showabout(\"buidinghtml\")'>Construction</a> | <a href='javascript:showabout(\"portfoliohtml\")'>Our works</a> | <a href='javascript:showabout(\"materialshtml\")'>Materials</a> | <a href='javascript:showabout(\"contactshtml\")'>Contacts</a></td><td width='182' align='center' valign='top' bgcolor='#000000'><span class='style6'>+(374231) 4-04-08, 4 04 06</span></td></tr></table>";
	/*	    document.getElementById("newstd").innerHTML="<table border='0' cellpadding='0' cellspacing='0' width='100%' style='background: url(/img/volhovec_done_19.gif);'><tr><td  align='left' style='background: url(/img/volhovec_done_17-1.gif) no-repeat;'><br><br><br><div id='dvplaceholder'></div><br><br><a href='javascript:showabout(\"abouthtml\")' ><img src='images/photos/iso.jpg' width='238' height='330' /></a><br><br></td></tr></table></p></td></tr></table>";*/
		    if (document.getElementById("hidflashrender").value=="0")
			{
		        document.getElementById("spmaintext").innerHTML="<br>Lupus company works in the Armenian market of interior and entrance doors since 2002 and has become one of the largest manufacturers of high-quality wooden and metal-plastic doors and windows.<a href='javascript:showabout(\"abouthtml\")'>more</a>";
			   document.getElementById("paragnews").innerHTML="New products";
		    }
		}
				

		    var url = "do.php";
	        var pars = "curlang=" + lnid + "&" + document.getElementById("hidlang").value;
	        var myAjax = new Ajax.Updater("", url, {method: "get", parameters: pars});
	        
	        if (document.getElementById("hidlang").value!="")
	        {
	            var url = "do.php";
	            var pars = "curlang=" + lnid + "&" + document.getElementById("hidlang").value;
	            var myAjax = new Ajax.Updater("placeholder", url, {method: "get", parameters: pars});
	        }
	        
	        
	    
	    if (document.getElementById("hidflashrender").value=="0")
		{		
			var url = "do.php";
		    var pars = "actflash=1";
		    var myAjax = new Ajax.Updater("dvplaceholder", url, {method: "get", parameters: pars});	 
		    document.getElementById("hidflashrender").value=="1"
	    }
	    
	    
	}
	
	
	function echeck(str) 
    {
        var at="@"
        var dot="."
        var lat=str.indexOf(at)
        var lstr=str.length
        var ldot=str.indexOf(dot)
        if (str.indexOf(at)==-1){
           alert("Please enter valid email address")
           return false
        }

        if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
           alert("Please enter valid email address")
           return false
        }

        if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
            alert("Please enter valid email address")
            return false
        }

         if (str.indexOf(at,(lat+1))!=-1){
            alert("Please enter valid email address")
            return false
         }

         if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
            alert("Please enter valid email address")
            return false
         }

         if (str.indexOf(dot,(lat+2))==-1){
            alert("Please enter valid email address")
            return false
         }
		
         if (str.indexOf(" ")!=-1){
            alert("Please enter valid email address")
            return false
         }

         return true					
    }
    
    
	var digits = "0123456789";
	// non-digit characters which are allowed in phone numbers
	var phoneNumberDelimiters = "()- ";
	// characters which are allowed in international phone numbers
	// (a leading + is OK)
	var validWorldPhoneChars = phoneNumberDelimiters + "+";
	// Minimum no of digits in an international phone no.
	var minDigitsInIPhoneNumber = 6;

	function isInteger(s)
	{   var i;
	    for (i = 0; i < s.length; i++)
	    {   
	        // Check that current character is number.
	        var c = s.charAt(i);
	        if (((c < "0") || (c > "9"))) return false;
	    }
	    // All characters are numbers.
// All characters are numbers.
	    return true;
	}
	
	function stripCharsInBag(s, bag)
	{   var i;
	    var returnString = "";
	    // Search through string's characters one by one.
	    // If character is not in bag, append to returnString.
	    for (i = 0; i < s.length; i++)
	    {   
	        // Check that current character isn't whitespace.
	        var c = s.charAt(i);
	        if (bag.indexOf(c) == -1) returnString += c;
	    }
	    return returnString;
	}
	
function checkInternationalPhone(strPhone)
	{
	s=stripCharsInBag(strPhone,validWorldPhoneChars);
	return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
	}
	
	function ValidateForm(){
		var Phone=document.getElementById("fromphone");
		
		if ((Phone.value==null)||(Phone.value=="")){
			alert("Please Enter your Phone Number")
			Phone.focus()
			return false
		}
		if (checkInternationalPhone(Phone.value)==false){
			alert("Please Enter a Valid Phone Number")
			Phone.value=""
			Phone.focus()
			return false
		}
		return true
	 }
	

	function redraw()
	{
		document.getElementById("maintable").style.bgColor="#f1f1f1";
		document.getElementById("maintable").style.backgroundColor="#f1f1f1";
		for (lnkid = 1; lnkid<=20; lnkid++)
		{
			try
			{
				lnkidname = "lnk" + lnkid;
				mnusectionname = "MenuSection" + lnkid;
				document.getElementById(lnkidname).style.color="#6d6d6d";				
			}
			catch(e)
			{				
			}
			//--------------------------------------------------------------------------------
try
			{
				mnusectionname = "MenuSection" + lnkid;
				document.getElementById(mnusectionname).style.bgColor="#d5d4d4";
				document.getElementById(mnusectionname).style.backgroundColor="#d5d4d4";
			}
			catch(e)
			{				
			}
			//--------------------------------------------------------------------------------
			try
			{
				picsec = "cont" + lnkid;
				document.getElementById(picsec).style.bgColor="#f1f1f1";
				document.getElementById(picsec).style.backgroundColor="#f1f1f1";
			}
			catch(e)
			{				
			}			
			
			//--------------------------------------------------------------------------------
			try
			{
				tdpicname = "tdpic" + lnkid;
				document.getElementById(tdpicname).style.display="block";				
			}
			catch(e)
			{				
			}
		}
		if (document.getElementById("hidflashrender").value=="0")
		{		
			var url = "do.php";
		    var pars = "actflash=1";
		    var myAjax = new Ajax.Updater("flashc", url, {method: "get", parameters: pars, onSuccess:setflashend});	 
	    }        
			  			
	}
	function setflashend()
	{
		document.getElementById("hidflashrender").value="1";  	
	}
	
	function showmenu(x)
	{
		for (i=1;i<=3;i++)
		{
			subsection = "subsection" + i;
			document.getElementById(subsection).style.display = "none";
		}
		
		subsection = "subsection" + x;
		document.getElementById(subsection).style.display = "block";
	}
	
	
	
	function hideindicator()
	{
		document.getElementById("imgstatus").style.visibility="hidden";
		redraw();
	}
	function showworks(codeofwork)
	{
		var url = "do.php";
	    var pars = "codeofwork=" + codeofwork;
	    document.getElementById("hidlang").value="codeofwork=" + codeofwork;
	    var myAjax = new Ajax.Updater("placeholder", url, {method: "get", parameters: pars, onSuccess:hideindicator});	 
	    
	}
	

	function showabout(type)
	{
		//document.getElementById("newstd").style.visibility="hidden";
		//document.getElementById("newstd").style.display="none";
		document.getElementById("imgstatus").style.visibility="visible";
		var url = "do.php";
	    var pars = "pagetype=" + type;
	    document.getElementById("hidlang").value="pagetype=" + type;
	    var myAjax = new Ajax.Updater("placeholder", url, {method: "get", parameters: pars, onSuccess:hideindicator});	 
	    
	}
	function showdoors(type)
	{
		//document.getElementById("newstd").style.visibility="hidden";
		document.getElementById("imgstatus").style.visibility="visible";
		//document.getElementById("newstd").style.display="none";
		var url = "do.php";
	    var pars = "doortype=" + type;
	    document.getElementById("hidlang").value="doortype=" + type;
	    document.getElementById("hidlang").value="doortype=" + type;
		var myAjax = new Ajax.Updater("placeholder", url, {method: "get", parameters: pars, onSuccess:hideindicator});	 
		
	    
	}
	
	function showdoorsinfo(code)
	{
		//document.getElementById("newstd").style.visibility="hidden";
		document.getElementById("imgstatus").style.visibility="visible";
		//document.getElementById("newstd").style.display="none";
		

		
		var url = "do.php?";
	    var pars = "doorcode=" + code;
	    document.getElementById("hidlang").value="doorcode=" + code;
	    var myAjax = new Ajax.Updater("placeholder", url, {method: "get", parameters: pars, onSuccess:hideindicator});	 
	    
	}
	
	
	function showwindows(type)
	{
		//document.getElementById("newstd").style.visibility="hidden";
		//document.getElementById("newstd").style.display="none";
		document.getElementById("imgstatus").style.visibility="visible";
		var url = "do.php";
	    var pars = "windowtype=" + type;
	    document.getElementById("hidlang").value="windowtype=" + type;
	    var myAjax = new Ajax.Updater("placeholder", url, {method: "get", parameters: pars, onSuccess:hideindicator});	 
	}
	
	function showwindowsinfo(code)
	{
		//document.getElementById("newstd").style.display="none";
		//document.getElementById("newstd").style.visibility="hidden";
		document.getElementById("imgstatus").style.visibility="visible";
		var url = "do.php";
	    var pars = "windowcode=" + code;
	    document.getElementById("hidlang").value="windowcode=" + code;
	    var myAjax = new Ajax.Updater("placeholder", url, {method: "get", parameters: pars, onSuccess:hideindicator});	 
	}
	
	
	function showfurniture(type)
	{
		//document.getElementById("newstd").style.visibility="hidden";
		document.getElementById("imgstatus").style.visibility="visible";
		//document.getElementById("newstd").style.display="none";
		var url = "do.php";
	    var pars = "furnituretype=" + type;
	    document.getElementById("hidlang").value="furnituretype=" + type;
	    var myAjax = new Ajax.Updater("placeholder", url, {method: "get", parameters: pars, onSuccess:hideindicator});	 
	    
	}
	
	function showfurnitureinfo(code)
	{
		//document.getElementById("newstd").style.visibility="hidden";
		document.getElementById("imgstatus").style.visibility="visible";
		//document.getElementById("newstd").style.display="none";
		var url = "do.php";
	    var pars = "furniturecode=" + code;
	    document.getElementById("hidlang").value="furniturecode=" + code;
	    var myAjax = new Ajax.Updater("placeholder", url, {method: "get", parameters: pars, onSuccess:hideindicator});	 
	}
	
	function sendemailmessage()
	{
		if (document.getElementById("hidsubject").value == "") 
		{
			alert("Please enter subject");
			return false;
		}
		if (document.getElementById("fromname").value == "") 
		{
			alert("Please enter your name");
			return false;
		}
		if (document.getElementById("fromname").value == "") 
		{
			alert("Please enter your name");
			return false;
		}
		if (document.getElementById("fromphone").value == "") 
		{
			alert("Please enter your phone");
			return false;
		}
		
		if (document.getElementById("fromphone").value != "") 
		{		
			if (!ValidateForm()) 
			{
				return false;
			}
		}
		
		if (document.getElementById("fromemail").value == "") 
		{
			alert("Please enter your email");
			return false;
		}
		
		if (document.getElementById("fromtext").value == "") 
		{
			alert("Please enter your text");
			return false;
		}
		
	    if (!echeck(document.getElementById("fromemail").value))
		{
			return false;
		}
		
		var url = "do.php";
	    var pars = "subject=" + document.getElementById("hidsubject").value + "&fromname=" + document.getElementById("fromname").value + "&fromphone=" + document.getElementById("fromphone").value + "&fromemail=" + document.getElementById("fromemail").value + "&fromtext=" + document.getElementById("fromtext").value;
	    var myAjax = new Ajax.Updater("placeholder", url, {method: "get", parameters: pars, onSuccess:hideindicator});
	}