window.onload=function(){
for(a=0;a<document.links.length;a++){
document.links[a].onfocus=document.links[a].blur}
generate_menu()
}
window.onscroll=function(){
l=document.location
if (l.href=='http://'+l.hostname+'/') l=389
else l=240
sc=getPageScroll()
s=$('mr_info_div').style
if (sc>l && s.position!='fixed'){
 s.position='fixed'
 s.top='10px'
}
else if(sc<=l && s.position!='absolute'){
 s.position='absolute'
 s.top=(l+10)+'px'
}
}

var SF1 = new SunFade('canvas0','canvas1')
var SF2 = new SunFade('canvas2','canvas3')
p='http://g1.pierwszapozycja.pl/certyfikaty/'
SF1.img[0]=p+'forbes.png'
SF1.img[1]=p+'deloitte_2010.jpg'
SF1.img[2]=p+'deloitte_fast500_2010.png'
SF1.img[3]=p+'firma_przyjazna_klientowi.png'
SF1.img[4]=p+'internetowa_rewolucja.png'
SF1.img[5]=p+'solidna_firma_2010.png'
SF1.img[6]=p+'fair_play_2010.png'
SF1.img[7]=p+'rzetelna_firma.png'
SF1.img[8]=p+'iab.png'
SF1.img[9]=p+'sempo.jpg'
SF1.img[10]=p+'google_adwords_certified.jpg'
SF1.img[11]=p+'adwords_qualified_individual.png'
SF1.img[12]=p+'analytics.jpg'
SF1.link[0]='http://www.sunrisesystem.pl/certyfikaty-i-wyroznienia.html'
p='http://g2.pierwszapozycja.pl/klienci/'
SF2.img[0]=p+'bz-wbk.jpg'
SF2.img[1]=p+'amica.jpg'
SF2.img[2]=p+'wprost.jpg'
SF2.img[3]=p+'yves-rocher.jpg'
SF2.img[4]=p+'bgz.jpg'
SF2.img[5]=p+'ricoh.jpg'
SF2.img[6]=p+'piotr-i-pawel.jpg'
SF2.img[7]=p+'junkers-grupa-bosh.jpg'
SF2.img[8]=p+'santander-consumer-bank.jpg'
SF2.img[9]=p+'medicover.jpg'
SF2.img[10]=p+'xtb.jpg'
SF2.img[11]=p+'bre-locum.jpg'
SF2.img[12]=p+'dr_irena_eris.jpg'
SF2.img[13]=p+'enea.jpg'
SF2.img[14]=p+'hsg-zander.jpg'
SF2.img[15]=p+'bergerat-monnoyeur.jpg'
SF2.img[16]=p+'wittchen.jpg'
SF2.img[17]=p+'big-star.jpg'
SF2.img[18]=p+'tikkurila.jpg'
SF2.img[19]=p+'jw-construction-holding.jpg'
SF2.img[20]=p+'db-schenker.jpg'
SF2.link[0]='http://www.sunrisesystem.pl/referencje.html'

//----
function SunFade(c1,c2){
this.img=new Array()
this.link=new Array()
this.fadestyle=new Array()
this.width='100%'
this.height='76px'
this.pause=3000
this.speed=100
this.curpos=10
this.c1=c1
this.c2=c2
this.curcanvas=c1
this.curindex=0
this.inthan=null
this.startit=SF_startit
this.set_opacity=SF_set_opacity
this.fadepic=SF_fadepic
this.rotateimage=SF_rotateimage
}

function SF_startit(i){
var t=this
t.curindex=i
t.fadestyle[0]='padding-top:0'
for (p=0;p<t.img.length;p++){
  i=new Image()
  i.src=t.img[p]
  t.link[p]=t.link[0]
}
document.write('<div style="text-align:center;position:relative;width:'+t.width+';height:'+t.height+';overflow:hidden"><div id="'+t.c1+'" style="position:absolute;width:'+t.width+';height:'+t.height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10;opacity:10;z-index:1000"></div><div id="'+t.c2+'" style="position:absolute;width:'+t.width+';height:'+t.height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10;opacity:10;visibility:hidden;z-index:1000"></div></div>')
t.rotateimage()
}

function SF_set_opacity(e,v){
if(e.filters) e.filters.alpha.opacity=v
else if(e.style.opacity) e.style.opacity=v/101
else if(e.style.MozOpacity) e.style.MozOpacity=v/101
}

function SF_fadepic(){
var t=this
if (t.curpos<110){
t.curpos+=10
var next=(t.curcanvas==t.c1)?t.c2:t.c1
t.set_opacity($(t.curcanvas),t.curpos)
t.set_opacity($(next),100-t.curpos)
}
else{
clearInterval(t.inthan)
temp=t.curcanvas
t.curcanvas=(t.curcanvas==t.c1)?t.c2:t.c1
$(t.curcanvas).style.visibility="hidden"
$(temp).style.zIndex--
t.curindex=(t.curindex<t.img.length-1)?t.curindex+1:0
setTimeout(function() {t.rotateimage();},t.pause)
}
}

function SF_rotateimage(){
var t=this
e=$(t.curcanvas)
e.innerHTML='<a href="'+t.link[t.curindex]+'" rel="nofollow"><img src="'+t.img[t.curindex]+'" style="'+t.fadestyle[t.curindex]+'"></a>'
t.curpos=10
t.set_opacity(e,t.curpos)
e.style.zIndex++
e.style.visibility='visible'
t.inthan=setInterval(function() {t.fadepic();},t.speed,t)
}
//----

function mandreil(z1,style){
 z2='sunrisesystem.pl'
 document.write('<a href=\"mailto:'+z1+'@'+z2+'\" class=\"poczta\" rel=\"nofollow\" style=\"'+style+'\">'+z1+'@'+z2+'<\/a>')
}

function getPageScroll(){
	var yScroll
	if (self.pageYOffset) yScroll = self.pageYOffset
  else if (document.documentElement && document.documentElement.scrollTop)// Explorer 6 Strict
		yScroll = document.documentElement.scrollTop
  else if (document.body) yScroll = document.body.scrollTop
	return yScroll
}

function $(e){return document.getElementById(e)}
function isemail(s) {return /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(s)}
function trim(s){return s.replace(/^\s*|\s*$/g,'')}
function ss_send_form(f){
 if (!trim($('ss_www').value)){alert('Proszę podać adres www.');$('ss_www').focus()}
 else if (!trim($('ss_email').value)){alert('Proszę podać adres e-mail.');$('ss_email').focus()}
 else if (!trim($('ss_telefon').value)){alert('Proszę podać numer telefonu.');$('ss_telefon').focus()}
 else if (!isemail($('ss_email').value)){alert('Podany adres e-mail jest nieprawidłowy');$('ss_email').focus()}
 else if (!trim($('code').value)){alert('Proszę przepisać kod z obrazka.');$('code').focus()}
 else{
  $('ss_hid').value='send'
  f.submit()
 }
}

function generate_menu(){
z=new Array()
x=new Array()
s='http://www.sunrisesystem.pl/'
z[0]=s
z[1]=s+'o-firmie.html'
z[2]=s+'oferta.html'
z[3]=s+'referencje.html'
z[4]=s+'certyfikaty-i-wyroznienia.html'
z[5]=s+'praca.html'
z[6]=s+'media.html'
z[7]=s+'kontakt.html'
x[0]='Strona główna'
x[1]='O firmie'
x[2]='Oferta'
x[3]='Referencje'
x[4]='Certyfikaty'
x[5]='Praca'
x[6]='Media'
x[7]='Kontakt'
ul=document.createElement('ul')
ul.id='menu'
$('all').insertBefore(ul,$('flagi'))
for(i=0;i<z.length;i++){
li=document.createElement('li')
a=document.createElement('a')
a.href=z[i]
a.innerHTML=x[i]
a.rel='nofollow'
if(i==0) a.className='sel'
li.appendChild(a);
ul.appendChild(li);
}
}

