/*
	Aquatika JS common script
	(c) 2008 Dmitry M Goltsov - www.imix.ru
*/

var opera = false;

if ( !document.layers ) { opera = ( navigator.userAgent.indexOf( 'Opera' ) != -1 ); }

var MM_contentVersion = 6;
var MM_FlashCanPlay = false;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if (plugin) {
    var words = navigator.plugins["Shockwave Flash"].description.split(" ");
    for (var i = 0; i < words.length; ++i) {
        if (isNaN(parseInt(words[i]))) continue;
        var MM_PluginVersion = words[i]; 
    }
    MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}

function showFlash(fa, fw, fh) {
 if (MM_FlashCanPlay) {
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + fw + '" height="' + fh + '">');
	document.write('<param name="movie" value="' + fa + '">');
	document.write('<param name="quality" value="high">');
	document.write('<embed src="' + fa + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + fw + '" height="' + fh + '"></embed>');
    document.write('</object>');
}
}


// Production table highlights

var pt_html_image_prefix = 'img_id';
var pt_html_link_prefix = 'link';
// 'pt_image_basedir' var and 'pt_link' array defined outside this script

function swapIMG( link_id, on_off ) {
	img = pt_html_image_prefix + link_id;
	img_e = document.getElementById(img);
	if ( img_e != null ) {
		afile = pt_link[link_id][on_off];
		document[img].src = pt_image_basedir + afile;
	}
}

function hltLINK( link_id, on_off ) {
	style_name = (on_off == 0 ) ? 'normlink' : 'hltlink';
	link_e = document.getElementById(pt_html_link_prefix + link_id);
	if ( link_e != null ) {
		link_e.className = style_name;
		swapIMG( link_id, on_off );
	}
} 

function swapGroupIMG( link_id, on_off ) {
	for( i = 0; i < pt_groups[link_id].length; i++) {
		img_no = pt_groups[link_id][i]
		img = pt_html_image_prefix + img_no;
		img_e = document.getElementById(img);
		if ( img_e != null ) {
			afile = pt_link[img_no][on_off];
			document[img].src = pt_image_basedir + afile;
		}
	}
}

function hltGroupLINK( link_id, on_off ) {
	style_name = (on_off == 0 ) ? 'normlink' : 'hltlink';
	link_e = document.getElementById(pt_html_link_prefix + link_id);
	if ( link_e != null ) {
		link_e.className = style_name;
		swapGroupIMG( link_id, on_off );
	}
} 

function preloadTblImgs() {
	if ( pt_link != null ) { // Table page
		fakeImg = new Image();
		tblItems = pt_link.length
		for ( i = 1; i < tblItems; i++ )
			fakeImg.src = pt_image_basedir + pt_link[i][1];
	}
}


function pop_win(uri, uW, uH) {
	wwidth = ( uW == null ) ? 350 : uW;
	wheight = ( uH == null ) ? 450 : uH;
	
	if ( opera ) { wheight += 7; }
	
	wleft = parseInt((screen.availWidth/2) - (wwidth/2));
	wtop = parseInt((screen.availHeight/2) - (wheight/2));
	winOp = "width=" + wwidth + ",height=" + wheight + ", status=yes,scrollbars=auto, resizable=yes, menubar=no, toolbar=no, left=" + wleft + ",top=" + wtop;
	window.open(uri, '', winOp);
}

function check_search ( f ) {
	if ( f.sstring.value == "" ) {
		alert("Строка для поиска пуста!!!");
		return false;
	}
	return true;
}