function pokaz(ref) {
	if (ref) document.getElementById(ref).style.display = 'block';	
}

function ukryj(ref) {
	if (ref) document.getElementById(ref).style.display = 'none';	
}

function nS(user,domain) {
         locationstring = "mailto:" + user + "@" + domain;
         window.location = locationstring;
} 


 if(typeof HTMLElement!='undefined'&&!HTMLElement.prototype.click)
    HTMLElement.prototype.click=function()
    {
        var evt = this.ownerDocument.createEvent('MouseEvents');
        evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
        this.dispatchEvent(evt);
    }

    
function klik(id) {
	  document.getElementById(id).click();
}
    
function closeRokbox() {
    window.parent.window.klik('rokbox-overlay');
}

currNum = 1;

delayTime = 10000;

tickIt = true;

_myPromoID = '';

function getH(divID) {

				if (document.getElementById(divID)) {
				var divHeight = document.getElementById(divID).clientHeight;								
				return(divHeight);
				}
}

function getW(divID) {

				if (document.getElementById(divID)) {
				var divWidth = document.getElementById(divID).clientWidth;								
				return(divWidth);
				}
}

function getY( el ) {
    var _x = 0;
    var _y = 0;
    while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) {
        _x += el.offsetLeft - el.scrollLeft;
        _y += el.offsetTop - el.scrollTop;
        el = el.parentNode;
    }
    return (_y);
}


function addStyle(el, s){
  if(typeof(el) == 'string'){el = document.getElementById(el);}
  var st = s.split(';');
  for(var i=0; i<st.length; i++){
    var stl = st[i].split(':');
    if(stl.length == 2){
      stl[0] = stl[0].replace(/^\s*|\s*$/g,"");
      stl[1] = stl[1].replace(/^\s*|\s*$/g,"");
      stl[1] = stl[1].replace(/'/g, "\"");
      tmpStl = stl[0].split('-');
      stl[0] = tmpStl[0];
      for(var j=1; j < tmpStl.length; j++){
        stl[0] += tmpStl[j].charAt(0).toUpperCase() + tmpStl[j].substr(1).toLowerCase();
      }
      delete tmpStl;
      if(stl[0].length > 3){eval('el.style.' + stl[0] + ' = \'' + stl[1] + '\';');}
    }
  }
  return false;
}

function windowSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
  return(myHeight);
}

function fixFooter(elementID) {

	windowH = windowSize();
	
	footerH = getH('footer');
	
	footerY = getY(document.getElementById('footer'));
	
	if ( (footerY + footerH) < windowH) {
	
		if (elementID == 'flow') moveIt = -28;
		if (elementID == 'footer') moveIt = 2;
	
		fix = windowH - footerH - footerY - moveIt;
	
	    
		document.getElementById(elementID).style.marginTop = fix+'px';
		if (elementID == 'flow') document.getElementById('welcome').style.marginTop = fix+'px';
	
	}

	reveal();

}

function flowTo(pos, myID) {


	for (i = 1; i <= 14; i++) {
	if (document.getElementById('aMini_'+labelID[i]))
	document.getElementById('aMini_'+labelID[i]).style.display = 'none';
	}
	
	document.getElementById('aMini_'+myID).style.display = 'block';

	_myscr = 326;

	_myPromoID = myID;

	korekta = parseInt( (document.body.clientWidth / 2) + (_myscr / 2) );

	newX = -(_myscr * pos) + korekta;
	
	document.getElementById('productLabel').style.marginLeft = (korekta - _myscr) + 'px';
	
}

function swapFoto(num) {

	for (i = 1; i <= 100; i++)
	
	if (document.getElementById('zoom'+i)) {
		ukryj('zoom'+i);
		ukryj('frame'+i);		
	}
	
	pokaz('zoom'+num);
	pokaz('frame'+num);
	
		

}

function switchButtonStatus() {
	
	ref = document.getElementById('noteButton');
	
	if (ref.innerHTML == 'do notatnika') newVal = 'usuń z notatnika'; else newVal = 'do notatnika'; 
	
	ref.innerHTML = newVal;
	
}

function bookmark() {

 title = "Karina: Exclusive Wedding Boutique"; 

 url = "http://karina.net.pl";

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
 }
