					   
					   
// Получим userAgent браузера и переведем его в нижний регистр
var ua = navigator.userAgent.toLowerCase();	
var CBrowser;
// Определим Internet Explorer
if((ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1)){CBrowser='ie'}; 
// Opera
if((ua.indexOf("opera") != -1)){CBrowser='opera'}; 
// Gecko = Mozilla + Firefox + Netscape
if((ua.indexOf("gecko") != -1)){CBrowser='gecko'}; 
// Safari, используется в MAC OS
if((ua.indexOf("safari") != -1)){CBrowser='safari'}; 
// Konqueror, используется в UNIX-системах
if((ua.indexOf("konqueror") != -1)){CBrowser='konqueror'}; 

function getNameBrouser() {
 var ua = navigator.userAgent.toLowerCase();
 // Определим Internet Explorer
 if (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1 && ua.indexOf("webtv") == -1) {
   return "msie"
 }
 // Opera
 if (ua.indexOf("opera") != -1) {
   return "opera"
 }
 // Gecko = Mozilla + Firefox + Netscape
 if (ua.indexOf("gecko") != -1) {
   return "gecko";
 }
 // Safari, используется в MAC OS
 if (ua.indexOf("safari") != -1) {
   return "safari";
 }
 // Konqueror, используется в UNIX-системах
 if (ua.indexOf("konqueror") != -1) {
   return "konqueror";
 }
 return "unknown";
}
					   
					   
function action_select_fon(a,b,c){

	if (a==1){c.style.background ='url(/pic/enterprise/interface/'+b+'_d.gif)';} else
	{c.style.background = 'url(/pic/enterprise/interface/'+b+'_a.gif)';}
}
function action_select(a,b,c){

	if (a==1){c.src='/pic/enterprise/interface/'+b+'_d.gif';} else
	{c.src='/pic/enterprise/interface/'+b+'_a.gif';}
}
function action_select_jpg(a,b,c){

	if (a==1){c.src='/pic/enterprise/interface/'+b+'_dis.jpg';} else
	{c.src='/pic/enterprise/interface/'+b+'_act.jpg';}
}
function action_select_gif(a,b,c){

	if (a==1){c.src='/pic/enterprise/interface/'+b+'_dis.gif';} else
	{c.src='/pic/enterprise/interface/'+b+'_act.gif';}
}
function openclose(a){
	    if (a.style.display=='none'){
		a.style.display='block';
		}else{
		a.style.display='none';
		}
}

function draworder(a){
a.draw.value = 'draw';
a.submit();
}

// name - имя cookie
// value - значение cookie
// [expires] - дата окончания действия cookie (по умолчанию - до конца сессии)
// [path] - путь, для которого cookie действительно (по умолчанию - документ, в котором значение было установлено)
// [domain] - домен, для которого cookie действительно (по умолчанию - домен, в котором значение было установлено)
// [secure] - логическое значение, показывающее требуется ли защищенная передача значения cookie

function setCookie(name, value, expires, path, domain, secure) {
        document.cookie = name + "=" + escape(value) +
                ((expires) ? "; expires=" + expires.toGMTString() : "") +
                ((path) ? "; path=" + path : "path=/") +
                ((domain) ? "; domain=" + domain : "") +
                ((secure) ? "; secure" : "");

}

function fixDate(date) {

	var base = new Date(0);

	var skew = base.getTime();

	if (skew > 0)

		date.setTime(date.getTime() - skew);

}  

function Call(){
 
Box.confirm('<h1>БЕСПЛАТНЫЙ ЗВОНОК</h1><br><div id="FreeCallAnswer"><form name="free_call">Представьтесь, пожалуйста:<br><input name="name" style="width: 220px;" type="text"><br>Ваш город:<br><input name="city" style="width: 220px;" type="text"><br>Ваш номер телефона:<br><input name="phone" style="width: 220px;" type="text"><br><br><div style="text-align: right"><input type=button style="font-size: 8pt; width: 70px; height: 22px; color: black;" value="Закрыть" OnClick="Box.options.onReturn = false; Box.display(0);">&nbsp;&nbsp;&nbsp;<input type=button style="font-size: 8pt; width: 110px; height: 22px; color: black;" value="Заказать звонок" OnClick="SendCall()"></div></form>');	

}  

function SendCall(){
if(free_call.name.value!='' && free_call.phone.value!=''){ 
	 
if (window.XMLHttpRequest) req_call = new XMLHttpRequest(); 
else if (window.ActiveXObject) {
    try {
        req_call = new ActiveXObject('Msxml2.XMLHTTP');
    } catch (e){}
    try {
    req_call = new ActiveXObject('Microsoft.XMLHTTP');
    } catch (e){}
}

if (req_call) {
    req_call.onreadystatechange = function() {
    	if (req_call.readyState == 4 && req_call.status == 200)  {document.getElementById("FreeCallAnswer").innerHTML = 'Ваш запрос принят.<br>Наш менеджер свяжется с вами в ближайшее время.<br><br><br><div align=right><input type=button style="font-size: 8pt; width: 70px; height: 22px; color: black;" value="Закрыть" OnClick="Box.options.onReturn = false; Box.display(0);"></div>';}        
    };  
    req_call.open("POST", '/ajax/?tmp='+Math.random(), true);
    req_call.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    req_call.send('tp=freecall&name='+free_call.name.value+'&city='+free_call.city.value+'&phone='+free_call.phone.value);

} 

}
}									 


function getScrollY() 
{
    scrollY = 0;    
    if (typeof window.pageYOffset == "number") {
        scrollY = window.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {
        scrollY = document.documentElement.scrollTop;
    }  else if (document.body && document.body.scrollTop) {
        scrollY = document.body.scrollTop; 
    } else if (window.scrollY) {
        scrollY = window.scrollY;
    }
    return scrollY;
}
  
function getInnerHeight() 
{
    height = 0;
    if (window.innerHeight) {
        height = window.innerHeight - 18;
    } else if (document.documentElement && document.documentElement.clientHeight) {
        height = document.documentElement.clientHeight;
    } else if (document.body && document.body.clientHeight) {
        height = document.body.clientHeight;
    }
    return height;
}
					 
function  getPageSize(){

       var xScroll, yScroll;

       if (window.innerHeight && window.scrollMaxY) {

               xScroll = document.body.scrollWidth;

               yScroll = window.innerHeight + window.scrollMaxY;

       } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac

               xScroll = document.body.scrollWidth;

               yScroll = document.body.scrollHeight;

       } else if (document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight){ // Explorer 6 strict mode

               xScroll = document.documentElement.scrollWidth;

               yScroll = document.documentElement.scrollHeight;

       } else { // Explorer Mac...would also work in Mozilla and Safari

               xScroll = document.body.offsetWidth;

               yScroll = document.body.offsetHeight;

       }

       var windowWidth, windowHeight;

       if (self.innerHeight) { // all except Explorer

               windowWidth = self.innerWidth;

               windowHeight = self.innerHeight;

       } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode

               windowWidth = document.documentElement.clientWidth;

               windowHeight = document.documentElement.clientHeight;

       } else if (document.body) { // other Explorers

               windowWidth = document.body.clientWidth;

               windowHeight = document.body.clientHeight;

       }

       // for small pages with total height less then height of the viewport

       if(yScroll < windowHeight){

               pageHeight = windowHeight;

       } else {

               pageHeight = yScroll;

       }

       // for small pages with total width less then width of the viewport

       if(xScroll < windowWidth){

               pageWidth = windowWidth;

       } else {

               pageWidth = xScroll;

       }

       return pageHeight;

}

		

function ViewWinMess(WWidth, WHight, WTop, WLeft, WBG, WText){


document.getElementById("WDMessFon").style.height= getPageSize()+'px';
document.getElementById("WDMessFon").style.width=document.body.clientWidth+'px';															   
document.getElementById("WDMess").style.width= WWidth+'px';
document.getElementById("WDMess").style.height=	WHight+'px';
document.getElementById("WDMess").style.top=document.body.clientHeight/2+getScrollY()-WHight/2;
document.getElementById("WDMess").style.left=document.body.clientWidth/2-WWidth/2;
document.getElementById("WDMess").style.background='url('+WBG+')';
document.getElementById("WDMessTop").style.height=	WTop+'px';	
document.getElementById("WDMessW").style.width=	WLeft+'%';	
document.getElementById("WDMess").style.display='block';
document.getElementById("WDMessFon").style.display='block';
document.getElementById("WDMessText").innerHTML=WText;
}

function ClearWinMess(){

document.getElementById("WDMess").style.display='none';
document.getElementById("WDMessFon").style.display='none';

}		

//Функция изменения размера текста:
function New_size (znak) {
 
   var size = 0;
   var new_size = 0;
   var def_size = 12;
   
   div = document.getElementById('dynamic_text');
   
   size = div.style.fontSize;
   size = size.replace("px","");
   size = parseInt(size)
   
   if (znak == '+') {
   new_size = size + 1;
   }
   
   if (znak == '-') {
   new_size = size - 1;
   }
   
   if (znak == 'res') {
   new_size = def_size;
   }   
 
   div.style.fontSize = new_size+"px";
 
}
//End
 
 
//Функция печать:
var textBuf;

function Print_window () {
   
   var width = 640;
   var height = 800;
   var div = document.getElementById('dynamic_text');
   textBuf = div.innerHTML;
   var win = window.open('/print.html', '', 'width='+width+',height='+height+', scrollbars=1');
   
}
//End
