var SiteTitle = 'JKK Moto';
var SiteURL = 'http://honda.jkk.com.pl';
var SiteKontaktHref = SiteURL + '/Public/Kontakt.aspx';
var SiteMojeKontoHref = SiteURL + '/WebForms/Konto/konto.aspx';

/*** Flash ***/
var MM_contentVersion = 8;
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]; 
	}
	var 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');
}
var ver = ( parseFloat( navigator.appVersion ) >= 4 );
var msie = ( navigator.appVersion.indexOf( "MSIE" ) != -1 );

/*** ***/
function doRotatePic( sciezka ){
    var elementy = new Array(
    '<img src="'+sciezka+'pic1.jpg" alt="Pictures" />',
    '<img src="'+sciezka+'pic2.jpg" alt="Pictures" />',
    '<img src="'+sciezka+'pic3.jpg" alt="Pictures" />'
    );

    var liczba = 0;
    liczba = Math.floor(Math.random() * elementy.length);
    document.write(elementy[liczba]);
}


function doFlash( name, fname, width, height, bgcolor, clickTag , sciezka, carsLinks) {
  if( bgcolor == null ) bgcolor='#ffffff';
  if( clickTag == null ) clickTag = '';
  if( sciezka == null ) sciezka = '';
  if ( MM_FlashCanPlay ) {
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
    document.write(' ID="'+name+'" width="'+width+'" height="'+height+'" ALIGN="">');
    document.write('<PARAM NAME="movie" value="'+fname+'.swf">');
	document.write('<PARAM NAME="wmode" value="opaque">');
	document.write('<PARAM NAME="flashvars" value="zm_sciezka=' + sciezka + '&zm_clickTag=' + clickTag + carsLinks + '">');
    document.write('<EMBED wmode="opaque" flashvars="zm_sciezka='+sciezka + '&zm_clickTag=' + clickTag + carsLinks + '" src="'+fname+'.swf" quality=high bgcolor='+bgcolor);
    document.write(' swLiveConnect=FALSE width="'+width+'" height="'+height+'" NAME="'+name+'" ALIGN=""');
    document.write(' TYPE="application/x-shockwave-flash">');
    document.write('</EMBED>');
    document.write('</object>');
	
  } else{
 		document.write('<center>');
		document.write('<p style="font-size: 14pt;">Brak zainstalowanej wtyczki Flash Player</p></br></br>');
		document.write('<a href="http://adobe.com/go/EN_UK-H-GET-FLASH">');
        document.write('<img alt="Pobierz Adobe Flash Player" border="0" src="http://adobe.com/images/shared/download_buttons/get_adobe_flash_player.png"/>');
        document.write('</a>');
        document.write('</center>');
  }
}

function old_DoFlash( name, fname, fnamealt, width, height,  bgcolor )
{
	if( bgcolor == null )
		bgcolor='#ffffff';

	if ( MM_FlashCanPlay )
	{
		document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
		document.write(' ID="'+name+'" WIDTH="'+width+'" HEIGHT="'+height+'" ALIGN="">');
		document.write('<PARAM NAME="movie" VALUE="'+fname+'" />');
		document.write('<PARAM NAME="quality" VALUE="high" />');
		if( bgcolor != -1 )
		{
			document.write('<PARAM NAME="bgcolor" VALUE="'+bgcolor+'" />');
			document.write('<EMBED src="'+fname+'" quality="high" bgcolor="'+bgcolor+'"');
		}
		else
		{
			document.write('<PARAM NAME="wmode" VALUE="transparent" />');
			document.write('<EMBED src="'+fname+'" quality="high" wmode="transparent"');
		}
		document.write(' swLiveConnect="FALSE" WIDTH="'+width+'" HEIGHT="'+height+'" NAME="'+name+'" ALIGN=""');
	    document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
		document.write('</EMBED>');
	    document.write('</OBJECT>');
	}
	else
	{
 		document.write('<center>');
		document.write('<p style="font-size: 14pt;">Brak zainstalowanej wtyczki Flash Player</p></br></br>');
		document.write('<a href="http://adobe.com/go/EN_UK-H-GET-FLASH">');
        document.write('<img alt="Pobierz Adobe Flash Player" border="0" src="http://adobe.com/images/shared/download_buttons/get_adobe_flash_player.png"/>');
        document.write('</a>');
        document.write('</center>');
	}
}

/*** ***/
function OpenPic(img,w,h,alt,left,top,margin) {
	// 720x405 -> 16:9 :)
	var dw = 720;
	var dh = 405;

	if( margin == null )
		margin = 0;

	newWindow = window.open("","newWindow","alwaysRaised,scrollbars=auto,status=no,titlebar=no,toolbar=no,hotkeys=no,location=no,menubar=no,resizable=yes,width="+(w?w+2*margin:dw+2*margin)+",height="+(h?h+2*margin:dh+2*margin)+",left="+left+",top="+top);
	newWindow.document.open();

	var xh = 0;
	if( typeof( document.all ) != 'object' )
		xh = 20;

	var strImg = '';
	if( w )
	{
		strImg += '<img border="0" src="'+img+'" width="'+w+'" height="'+h+'" alt="'+alt+'" />';
	}
	else
	{
		if( typeof( document.all ) == 'object' )
			strImg += '<img onload="window.resizeTo(this.width+20+'+(2*margin)+',this.height+(this.height*0.2)+'+(2*margin)+');" border="0" src="'+img+'" alt="'+alt+'" />';
		else
			strImg += '<img onload="window.resizeTo('+dw+','+dh+');window.resizeTo(this.width+'+(dw+2*margin)+'-window.innerWidth,this.height+'+(dh+2*margin)+'-window.innerHeight);" border="0" src="'+img+'" alt="'+alt+'"/>';
	}

	var str = '';
	str += ''
		+'<html>'
		+'<head>'
		+'<title>'+alt+'</title>'
		+'</head>'
		+'<body onload="window.focus()" bgcolor="#000000" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="/*self.close()*/">'
		+'<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">'
		+'<tr>'
		+'<td align="center" valign="center">'
		;
	if( strImg.substr( -4 ) == '.swf' )
	{
		str += ''
			+'FLASH!!!'
			+strImg
			+''
			;
	}
	else
	{
		str += ''
			+'<a href="javascript:window.close()">'
			+strImg
			+'</a>'
			;
	}

	str += ''
		+'</td>'
		+'</tr>'
		+'</table>'
		+'</body>'
		+'</html>'
		;
	newWindow.document.write( str );
	newWindow.document.close();
	newWindow.focus();
}

/*** Przyciski TopNavi ***/
function doTopNavi(what)
{
	if(what == 'kontakt')
		location.href = SiteKontaktHref;
	else if(what == 'startowa')
		setAsHomePage();
	else if(what == 'ulubione')
		addToFavorite();
	else if(what == 'mojekonto')
		location.href = SiteMojeKontoHref;
}

/*** ***/
function setAsHomePage()
{
	if( typeof(window.external) == 'undefined' )
	{
		alert('Twoja przeglądarka nie obsługuje tej funkcji!\nSpróbuj przeciągnąć adres tej strony na ikonę strony domowej\nlub skorzystaj z menu "Opcje" przeglądarki.');
		return;
	}
	overDiv.style.behavior = 'url(#default#homepage)';
	overDiv.setHomePage( SiteURL );
}

/*** ***/
function addToFavorite()
{
	if( typeof( document.all ) == 'object' )
		window.external.AddFavorite( SiteURL, SiteTitle );
	else if( typeof( window.sidebar ) == 'object' )
		window.sidebar.addPanel( SiteTitle, SiteURL, "" ); 
	else
		alert('Twoja przeglądarka nie obsługuje tej funkcji,\nmusisz ręcznie dodać tę stronę do zakładek/ulubionych.');
}

/*** Przelaczanie 2 blokow DIV ***/
function switchTab( tab2show, tab2hide )
{
	obj = document.getElementById( tab2hide );
	if( obj != null && typeof( obj ) != 'undefined' )
	{
		obj.style.visibility = 'hidden';
		obj.style.display = 'none';
	}
	obj = document.getElementById( tab2show );
	if( obj != null && typeof( obj ) != 'undefined' )
	{
		obj.style.visibility = 'visible';
		obj.style.display = 'block';
	}
}

/*** ***/
var lastWoj = null;
function doWoj( w )
{
	switch( w )
	{
	case 'dolnoslaskie':
	case 'kujawsko-pomorskie':
	case 'lubuskie':
	case 'lodzkie':
	case 'lubelskie':
	case 'mazowieckie':
	case 'malopolskie':
	case 'opolskie':
	case 'podlaskie':
	case 'podkarpackie':
	case 'pomorskie':
	case 'slaskie':
	case 'swietokrzyskie':
	case 'warminsko-mazurskie':
	case 'wielkopolskie':
	case 'zachodnio-pomorskie':
		break;
	default:
		w = '';
	}
	//document.location.href = 'http://www.liberty.com.pl/index.php?' + s;
	switchTab( 'woj_' + w, lastWoj );
	lastWoj = 'woj_' + w;
}




/*
var LTcmsValidatorEmailRegexp = new RegExp("^(([a-z0-9\-]+\.)?([a-z0-9\-]+))+\@([a-z0-9-]+\.)+[a-z]{2,6}$","i");
function LTcmsValidatorEmailChk(value)
{
	if( value == null )
		return false;
	if( !value.match( LTcmsValidatorEmailRegexp ) )
		return false;
	return true;
}
*/
/*
function LTcmsCommonPublishMsg(arg)
{
	switch( arg )
	{
		case 'NotPublishedStart':
			alert('Treść nie jest jeszcze publikowana!\r\nWybierz Edytuj, by zmienić czas publikowania treści!');
			break;
		case 'NotPublishedEnd':
			alert('Upłynął czas publikowania treści!\r\nWybierz Edytuj, by zmienić czas publikowania treści!');
			break;
	}
}
*/
function CloseAndReloadParent(url)
{
    if(window.parent != window.self)
    {
        if(url==null)
            window.parent.location.reload(true);
        else
            window.parent.location.href=url;
        window.close;
    }
}




