var idReloadTimer = 0;
var idTimer01 = 0;
var idTimer02 = 0;
var BasketIFrame = 0;
var imagesubmit;
var HistoryDeep = -1;
var ipaddr = '38.107.191.91';

try{
    var topLoc = new String(window.top.location);
    var topl = topLoc.length;
}
catch (err){
    if(err.number == -2146828218){
	document.domain='trida.ru';
    }
}
function donothing(){
    return false;}
    
document.onselectstart = donothing;
document.oncontextmenu = donothing;

function ShowOrderFact(item, cookie){
    if(item.src){
	imagesubmit = item;
	    item.src="/Images/i_ordered.gif";
    }
}

function ShowBasketWindow(URL, form){
    var BasketInES = false;
    BasketIFrame = window.frames[0];
    if(BasketIFrame){
	    BasketInES = true;
    }
    if(BasketInES){
	BasketIFrame.location.replace(URL + '&Qty=' + form.Qty.value);
	var cmd="ReloadIFrame()";
	idReloadTimer=window.setTimeout(cmd, 1000);
    }else{
	BasketWindow=window.open (URL + '&Qty=' + form.Qty.value, 'basket', 'width=400, height=200, scrollbars=1');
	if(BasketWindow==0)
	    return true;
    }    
    return false;
}
function SubmitLangForm(lang){
    var Form = document.forms.LanguageForm;
    if(Form){
	Form.elements["lang"].value=lang;
	Form.submit();
    }
}
function closeParentWindows(){
	return;
}
function CheckFSFCanSubmit(form){
	//alert(form);
	if(form.elements[1]){
		if(form.elements[1].value == 0){
			alert('Выберите, пожалуйста, раздел каталога');
			return false;
		}
	}
	return true;
}
function onBodyLoad(){
	var select = document.getElementById('shortFSFDirSelect');
	if(select){
		onDirSelect(select);
	}
	select = document.getElementById('FSFDirSelect');
	if(select){
		onDirSelect(select);
	}
	onTimer01();
	//setInterval('Friday()',5);
	//Friday();
}

function onTimer02(){
	var size;
	var f = document.getElementById('font01');
	if(f){
		size = f.getAttribute('size');
		f.setAttribute('size', eval(size) - 1);
	}else{
		return;
	}
	f = document.getElementById('font02');
	if(f){
		size = f.getAttribute('size');
		f.setAttribute('size', eval(size) + 1);
		idTimer02 = window.setTimeout("onTimer01()", 1000);
	}else{
		return;
	}
}

var tdbColors = new Array();
tdbColors[0]='#FFFFFF';
tdbColors[1]='#F8F8F8';
tdbColors[2]='#EEEEEE';
tdbColors[3]='#E8E8E8';
tdbColors[4]='#DFDFDF';
tdbColors[5]='#D8D8D8';
tdbColors[6]='#CFCFCF';
tdbColors[7]='#C8C8C8';
tdbColors[8]='#BFBFBF';
tdbColors[9]='#B8B8B8';
tdbColors[10]='#AFAFAF';
tdbColors[11]='#A8A8A8';
tdbColors[12]='#9F9F9F';
tdbColors[13]='#989898';
tdbColors[14]='#8F8F8F';
tdbColors[15]='#888888';

var currentColorIndex = 0;
var colorDirection = 'ASC';
function onTimer01(){
	var teldiv = document.getElementById('teldiv');	
	if(teldiv){
		teldiv.style.border = "Solid " + tdbColors[currentColorIndex] + " 2px";
		if(currentColorIndex == tdbColors.length - 1){
		    colorDirection = 'DESC';
		}
		if(currentColorIndex == 0){
		    colorDirection = 'ASC';
		}
		
		if(colorDirection == 'ASC'){
		    currentColorIndex++;
		}else{
		    currentColorIndex--;
		}

		idTimer01 = window.setTimeout("onTimer01()", 100);
	}else{
		return;
	}
}

function ShowOrderButton(){
	var ob = document.getElementById('orderButton');
	if(ob){
		ob.style.display = '';
	}else{
		return;
	}
}

    var R=0;
    function Friday(){
	    
    x1=.1;
    y1=.05;
    x2=.25;
    y2=.24;
    x3=1.6;
    y3=.24;
    x4=350;
    y4=250;
    x5=450;
    y5=350;
    sft = document.getElementById('sftable');
    DI=sft.getElementsByTagName('IMG');
    DIL=DI.length;

	for(i=0; i<DIL; i++){
	    DIS=DI[ i ].style;
	    DIS.position='absolute';
	    DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5;
	    DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5;
	}
	R++;
    }
