
function psBlinking(id,status,url) {

	if (status == 2)
		document.getElementById("menuPointDiv"+id).onclick = function() {window.location=url};



	$("#menuPoint228").animate({opacity: 'hide'}, 300);
	$("#menuPoint228").animate({opacity: 'show'}, 300);
	
	setTimeout(function(){psBlinking(id,status)},8000);

return;
	if (status == 1){
		status = 0;
//		document.getElementById("menuPoint"+id).style.display = 'none';
		setTimeout(function(){psBlinking(id,status)},300);
	}else{
		status = 1;	
//		document.getElementById("menuPoint"+id).style.display = '';		

		setTimeout(function(){psBlinking(id,status)},300);
	}
}


// ------------------------------------------------------
var currentWindow;

function closeBackGround(){
	obj = psCreateDiv('closeFonId');
	obj.className='psCloseBackGround';
	obj.style.height=psGetPageSize()[1]+'px';
	obj.style.width=psGetPageSize()[0]+'px';	
}

// - Windows --------------------------------------------
function psOpenInPopUp (idName,url){
	closeBackGround();

	objWindow =	psCreateDiv('psWindow');
	objWindow.style.position='absolute';
	objWindow.style.zIndex=1100;
	objSrc = document.getElementById(idName);

	if(url){
		currentWindow = url;		
		reqMain = new JsHttpRequest();
		reqMain.caching = false;
		reqMain.open('GET',url,true);
		var sdata = Array();
		sdata['cmd']='sendlink';
		reqMain.send(sdata);	
		reqMain.onreadystatechange = function(){
			if (reqMain.readyState == 4){
				if (reqMain.responseJS){
					PageContent = reqMain.responseJS.PageContent;
					objWindow.innerHTML = PageContent;
					psPosionPopUp(objWindow);
				}
			}
		}		
	}else{
		objWindow.innerHTML = objSrc.innerHTML;
		psPosionPopUp(objWindow);
	}
}

function psClosePopUp(){
	psDeleteObj('psWindow');
	psDeleteObj('closeFonId');
}

function psPosionPopUp(obj){
	var objTop=(((psGetPageSize()[3]-obj.offsetHeight)/2)+psGetPageScroll());
	var objLeft=((psGetPageSize()[0]-obj.offsetWidth)/2);
	obj.style.top = (objTop<=0)?'0px':objTop+'px';
	obj.style.left = (objLeft<=0)?'0px':objLeft+'px';	
}
// - Windows --------------------------------------------

// - Send Form --------------------------------------------
function psSendForm(formData){
	reqMain = new JsHttpRequest();
	reqMain.caching = false;
	reqMain.open('POST',formData.action,false);
	var sdata = Array();

	for (var i=0; i<formData.elements.length; i++)
		sdata[formData.elements[i].name] = formData.elements[i].value;

	reqMain.send(sdata);
	reqMain.onreadystatechange = function(){
		if (reqMain.readyState == 4){
			if (reqMain.responseJS){
				psShowFormResult(reqMain.responseJS);
				return false;
			}
		}
	}

	return false;
}

function psShowFormResult(data){
	psFormErrorsId = document.getElementById('psFormErrors');
	psFormMessegesId = document.getElementById('psFormMesseges');
	psFormFieldsId = document.getElementById('psFormFields');

	psFormMessegesId.style.display='none';
	psFormErrorsId.style.display='none';	
		
	if (data.Error){
		psFormErrorsId.style.display='';
		psFormErrorsId.innerHTML=data.Error;
		psReloadCaptcha(data);		
	}else if (data.Messeges){
		psFormMessegesId.style.display='';
		psFormFieldsId.style.display='none';
		psFormMessegesId.innerHTML=data.Messeges;		
	}else{
		psFormErrorsId.style.display='';
		psFormErrorsId.innerHTML='Ошибка при предаче данных';
	}
}

function psReloadCaptcha(data)
{
	psFormCaptchaId = document.getElementById('psFormCaptcha');
	psFormCaptchaId.src = currentWindow+'?cmd=get_captcha&'+data.sid+'&'+data.rand
}

function psOver(urlO,obj){
	url = obj.src;
	obj.src = urlO;
	obj.onmouseout = function(){
		obj.src = url;
	}
}

function psShowHide(id){
	var showObj=document.getElementById(id).style
	if (showObj.display=="none")
		{showObj.display=""}
	else {showObj.display="none"}
}

function psPreloadImg(url){
	var image = new Image();
	image.src = url;	
}

// - print----------------
function psPrint(obj)
{
  popupWin = window.open(obj.href, '', 'width=700,height=600,toolbar=no,menubar=yes,location=no,status=yes,resizable=yes,scrollbars=yes,left=50,top=50');
  popupWin.focus();
  return false;   
}
// - print----------------



// - old functions ----------------------------------------------------------
var resId=0;
var imgWndw;
function popimg(imgLink, Title) {
  if (typeof(window.resizeBy)=='undefined') return true;
  var sl=(document.body.clientWidth-100)/2;
  var st=(document.body.clientHeight-100)/2;
  imgWndw=window.open(imgLink,'swnd','width=544,height=408,toolbar=no,menubar=no,location=no,status=no,resizable=yes,scrollbars=no,left='+sl+',top='+st);
  imgWndw.focus();
  with (imgWndw.document){
    open();
    write('<ht'+'ml><he'+'ad><ti'+'tle>'+Title+'</ti'+'tle>'+ '</he'+'ad><bo'+'dy leftmargin="0" topmargin="0" '+ 'rightmargin="0" bottommargin="0" marginwidth="0" '+ 'style="margin:0; background:#ffffff;padding:0;position:fixed;overflow:none;" '+ 'marginheight="0"><img src="'+imgLink+'" border="0" '+ ' alt="'+Title+'" title="'+Title+'" /></bo'+ 'dy></ht'+'ml>');
    close();
  }
  resId=setInterval('psImgResize()',100);
  return false
}

function psPopPage(pageLink,width,height,scrollShow,panelOption){
  width = (width && width !== 'auto')?width:(document.body.clientWidth-100)/1.4;
  height = (height && height !== 'auto')?height:(document.body.clientHeight-100)/1.4;
  scrollShow = (scrollShow == 'no')?'no':'yes';
  if (panelOption == 0 ) panel = 'toolbar=no,menubar=no,location=no';
  else if (panelOption == 2 ) panel = 'toolbar=yes,menubar=yes,location=yes';
  else panel = 'toolbar=no,menubar=yes,location=no';

  popupWin = window.open(pageLink, '', 'width='+width+',height='+height+','+panel+',status=yes,resizable=yes,scrollbars='+scrollShow+',left=50,top=50');
  popupWin.focus();
  return false
}

function psImgResize() {
  var w=imgWndw.document.images[0].width;
  if (w>screen.availWidth) w=screen.availWidth;
  var h=imgWndw.document.images[0].height;
  if (h>screen.availHeight) h=screen.availHeight;
  if (w>50 && h>50) {
    var ww=(imgWndw.innerWidth)?imgWndw.innerWidth:((document.body)? imgWndw.document.body.clientWidth:null);
    var wh=(imgWndw.innerHeight)?imgWndw.innerHeight:((document.body)? imgWndw.document.body.clientHeight:null);
    if (ww && wh) {imgWndw.resizeBy(w-ww,h-wh);
    var sw=(document.body.clientWidth-w)/2;
    var sh=(document.body.clientHeight-h)/2;
    if (sh<0) sh=0; if (sw<0) sw=0;
    imgWndw.moveTo(sw,sh);
    }
    imgWndw.focus();
    clearInterval(resId)
  }
}

//-----------------------------------------Flash-------------------------------------------

function Flash( ) {
	
		this.name = false;
    this.transparent = true;
    this.needFlashVerion = 8;          
    this.flashvars = "xml_source=/ixml/&menuselid=0";
    this.BrowserInfo( );

}

/* Метод определения типа Браузера */
Flash.prototype.BrowserInfo = function( ) { 
 
    var userAgent = navigator.userAgent.toLowerCase( );
       this.browserIE = ( userAgent.indexOf( 'msie' ) != -1 );

}

/* Метод для опеределения нужной версии флэша */
Flash.prototype.CheckVersionFlash = function( needVersion ) {
 
    if ( navigator.plugins[ 'Shockwave Flash' ] ) {
        /* определяем есть ли у браузера plugin флэшплеера */
        matchStr = new RegExp ( '^[A-Za-z ]*(.*) .*$' );
        this.flashVerion = parseInt( navigator.plugins[ 'Shockwave Flash' ].description.replace( matchStr, '$1' ) );
        return ( needVersion <= this.flashVerion );
    }
    else if ( this.browserIE ) {
        /* иначе будет создаваться ActiveX объект (IE) */
        for( var i = needVersion; i < needVersion + 10; i++ ) {
            try {
                    flashPlayer = new ActiveXObject( 'ShockwaveFlash.ShockwaveFlash.' + i );
                    this.flashVerion = i;
                    return true;
            }
            catch( e ) {
                continue;
            }
        }
        return false;     
    }
    else {
        this.flashVerion = 0;
        return false;
    }
 
}

/* Метод вставки в страницу HTML нужного кода */
Flash.prototype.Insert = function( ) {
 
    if ( this.CheckVersionFlash( this.needFlashVerion ) ) {
        document.write( this.GenerateHtmlFlash( ) );
    }
    else {
        document.write( this.GenerateHtmlImage( ) );
    }
     
}

/*-------------------- Метод для генерирования Flash - кода ----------------------------*/
Flash.prototype.GenerateHtmlFlash = function( ) {
 
    var flashCode = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
    flashCode += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version= ' + this.flashVerion + ',0,0,0"' + ' width="' + this.width + '" height="' + this.height + '" align="middle">';
    flashCode += '<param name="allowScriptAccess" value="always"/>';
    flashCode += '<param name="movie" value="' + this.srcFlash + '"/>';
    flashCode += '<param name="quality" value="high"/>';
    if ( this.base ) {
        flashCode += '<param name="base" value="' + this.base + '"/>';
    }
    if ( this.background ) {
        flashCode += '<param name="bgcolor" value="' + this.background + '"/>';
    }
    if ( this.transparent ) {
        flashCode += '<param name="wmode" value="transparent"/>';
    }
    if ( this.flashvars ) {
        flashCode += '<param name="flashvars" value="' + this.flashvars + '"/>';
    }
 
    flashCode += '<embed quality="high" allowScriptAccess="always" type="application/x-shockwave-flash"' + ' pluginspage="http://www.macromedia.com/go/getflashplayer" ';
    flashCode += 'src="' + this.srcFlash+'" ' + '" width="' + this.width + '" height="' + this.height + '" ';
    if ( this.base ){
        flashCode += ' base="' + this.base + '"';
    }
    if ( this.background ){
        flashCode += ' bgcolor="' + this.background + '"';
    }
    if ( this.transparent ){
        flashCode += ' wmode="transparent"'
    }
    if ( this.name ){
        flashCode += ' name="'+this.name+'"';
    }		
    if ( this.flashvars ){
        flashCode += ' flashvars="' + this.flashvars + '"';
    }
    flashCode += '></embed>';
 
    flashCode += '</object>';
    return flashCode;
 
}

/* Метод для генерирования image - кода */
Flash.prototype.GenerateHtmlImage = function( ) {
 
document.getElementById('no_flash').style.display=""; 

//var imageCode = '<img src="' + this.srcImage + '"/>';
    return '';
 
}





function trim(str) {
return str.replace(/^\s*/,'').replace(/\s*$/,'');
}


//function setToRed ()
//{
//  document.getElementById("colourText").style.color = "#ff0000";
//
//  setTimeout ( "setToWhite()", 400 );
//}
//
//function setToWhite ()
//{
//  document.getElementById("colourText").style.color = "#000000";
//
//	setTimeout ( "setToRed()", 400 );
//}
