/*

	Программирование и концепция ООО "Алмадеста"
	Репин Дмитрий Николаевич
	e-mail: admin@al52.com
	Tel: +7 (8312) 573-364, 635-034
	admin@al52.com, director@al52.com
	Россия
	Нижний Новгород
	url: http://www.al52.com
	Использование только с полного согласия автора скрипта.

*/


var CTxt = "ВНИМАНИЕ!\nОбязательное поле\n";
var ErrField = "Неверное значение в поле\n";
var ErrQuant = "В этом поле следует указать только цифры";
var ETxt = "\nне указано пожалуйста заполните это поле\nили укажите больше число символов.\nВ том числе без начальных и хвостовых пробелов.";
var Host = 'http://'+window.location.hostname+'/';
var w=500; 
var h=480;
var t=(screen.height-h-20)/2; 
var l = (self.screen.width-w)*9/10;	  
var set_val=0;	 
var act_menu=0;	   
var new_menu=0;


var reEmail=new RegExp('([._a-z0-9-]+[._a-z0-9-]*)@([a-z0-9-]+\.)*([.])([a-z]{2,3})$');
var reImg = new RegExp('\.(jpeg|jpg)$');
var rePrice = new RegExp('\.(exe|zip|rar|arj)$'); 
var reWord = new RegExp('\\s\\w+');
var reSpace = new RegExp('^(\\s+|\\s*)$');
var reMoney = new RegExp('^\\d+[.]{0,1}\\d+$');
var reQuantity = new RegExp('^\\d+$');
var rePhone = new RegExp('\\d+\\s*\\w*[-()]*');
var reDate = new RegExp('\\d{4,}\\s*\\w*[-()]*');

function isEmpty(Set) {
if (Set.value.length < isEmpty.arguments[1])  return true;
else return false;
 }

function EmptyDef(Set) {
if (Set.value.length > 0)  return true;
else return false;
 }
 
function isBig(Set) {
if (Set.value.length > isBig.arguments[1])  return true;
else return false;
 }

function ChMail(Set){
Mail = Set.value.toLowerCase();
Mail = trim(Mail);
if(!reEmail.test(Mail))alert('Неверно введен адрес e-mail!');
else return true;
return false;
  }
  
  function trim(str){
str.replace(/^\s+/, '');
str.replace(/\s+$/, '');
return str;
}


function _img(Img, w, h) {
alt = window.document.title;
t=parseInt((screen.height-h)/5); 
l=parseInt((self.screen.width-w)*9/10);
d = open('',h,'menubar=0,directories=0,location=0,toolbar=0,scrollbars=0,status=0,resizable=0,width='+w+',height='+h+',top='+t+',left='+l);
with(d.document){
focus();
open();
write('<html><head><title>'+alt+'</title></head>');
write('<body topmargin=0 marginheight=0 marginwidth=0 bottommargin=0 rightmargin=0 leftmargin=0 onselectstart="return false;" background="/img/load.gif" style="background-color:#4F5A68;background-position:center;background-repeat:no-repeat;">');
write('<img src='+Host+Img+' width='+w+' height='+h+' border=0 alt="'+alt+'" disabled="return false;">');
write('</body></html>');
close(); 
   }
}

function _highl(obj) {
	bg = obj.style.backgroundColor;
	obj.style.backgroundColor = '#dddddd';
	}
function _rstr(obj) {
	obj.style.backgroundColor = bg;
	}

  
function ChImg(pic, Img) {
document[pic].src = '/'+Img;
}  

function ChSearch(Set){
if (isEmpty(Set,1)) alert(CTxt+'поиск'+ETxt+'\nНе менее 2 и не более 64 символов.');
else if (isBig(Set,64)) alert(CTxt+'Состоит из слишком большого числа символов чем указано,\nпожалуйста, повторите поиск еще раз...');
else return true;
return false;
  }
  
function _open(pg, w, h, ph, scr) {
scr = scr;
if(w > 860 || h> 860){
h = 560;
w = 860;
scr = 1;
}

t=parseInt((screen.height-h)/5); 
l=parseInt((self.screen.width-w)*9/10);
d = open(Host+pg,ph,'menubar=0,directories=0,location=0,toolbar=0,scrollbars='+scr+',status=0,resizable=1,width='+w+',height='+h+',top='+t+',left='+l);
d.document.focus();
}

function SelField(Set,txt){
alert(txt);
Set.focus();
Set.select();
}

function _icon(img,alt,w,h) {
with(document){
if(_check()) {
write('<img src='+img+' width='+w+' height='+h+' border=0 alt="'+alt+'">');
   } else {
write('<div style="width:'+w+'px;height:'+h+'px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='+img+')">&nbsp;</div>');
        }
   }
}



			function hoverField(me) {
					if (me.className == 'inps') me.className='inpshover';
					else me.className = 'inpshover';
			}
			
			function hoverOffField(me) {
					if (me.className == 'inpshover') me.className='inps';
					else me.className = 'inps';
			}
			

			
			

p=new Array;
p[0] = new Image(); p[0].src = '/uploads/images/visual/v1.jpg';
p[1] = new Image(); p[1].src = '/uploads/images/visual/v2.jpg';
p[2] = new Image(); p[2].src = '/uploads/images/visual/v3.jpg';
p[3] = new Image(); p[3].src = '/uploads/images/visual/v4.jpg';
p[4] = new Image(); p[4].src = '/uploads/images/visual/v5.jpg';
p[5] = new Image(); p[5].src = '/uploads/images/visual/v6.jpg';
p[6] = new Image(); p[6].src = '/uploads/images/visual/v7.jpg';
p[7] = new Image(); p[7].src = '/uploads/images/visual/v8.jpg';
p[8] = new Image(); p[8].src = '/uploads/images/visual/v9.jpg';
p[9] = new Image(); p[9].src = '/uploads/images/visual/v10.jpg';


var count = 0; 

var speed=10000;i=-1;

function my_replace(i){
i++;
if (i>=p.length){i=0};
if (setTimeout("my_replace("+i+")", speed) ) {
try {
pics.filters[0].Apply();
l5.src=p[i].src;
pics.filters[0].Play();
}
catch(e){
}
}
}

function getRandom(max) {
return (Math.floor(Math.random()*max));
}

function GetNumber(){
   return 12;
var nums = new Array(4,5,6,7,12,13,14,15,16);
   mynumber = getRandom(9);
   num = nums[mynumber];
   return num;
}

function init(){
//bottDiv.innerHTML=topDiv.innerHTML; 
my_replace(0); 
//blendMe();
}



function str_replace(substr,newsubstr,str) {
	replace_count=0;
	while (str.indexOf(substr)>=0) {
		str=str.replace(substr,newsubstr);
		replace_count++;
		}
	return(str);
	}			