/*
* Plugins JS scripts
/*/
function changeAttributesPrice( ){
  var fPriceAdd = 0;
  var aSelects = gEBI( 'attributes' ).getElementsByTagName( 'select' );
  for( var i = 0; i < aSelects.length; i++ ){
    var aSelect = aSelects[i];
    if( aSelect.className == 'attributes' ){
      var aSelectValue = aSelect.options[aSelect.options.selectedIndex].value;
      if( aSelectValue != '' )
        var aAttribute = aSelectValue.split( "|" );
      else
        var aAttribute = Array( 0, 0 );
      if( aAttribute[1] != '' ){
        fPriceAdd += ( generatePrice( fPrice, aAttribute[1] ) - fPrice );
      }
    }
  } // end for
  gEBI( 'priceValue' ).innerHTML = changePriceFormat( fix( fPrice * 1 + fPriceAdd ) );
} // end function changeAttributesPrice

function findCookie(searchName){
	var cookies = document.cookie.split(";");
	for (var i = 0; i < cookies.length; i++) {
		var cookieCrumbs = cookies[i].split("=");
		var cookieName = cookieCrumbs[0].replace(" ","");
		var cookieValue = cookieCrumbs[1];

		if(cookieName == searchName) return cookieValue;
	}
	return false;
}
function nokaut_track_transaction(shop_id, transactionValue, transactionComment) {
	var name = "nokaut=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(name) == 0) {
			v = c.substring(name.length,c.length);
			v = v.split(",");
			if(v[0].indexOf("nokaut.pl") != -1)
				document.write("<img src=\"http://www.nokaut.pl/NewConversion/-/" + shop_id + "/" + v[1] + "/" + transactionValue  + "/" + transactionComment + "\" width=\"0\" height=\"0\" />");
		}
	}
	return null;
}

function windowNew( sAdres, iWidth, iHeight, sTitle, iReturn ){
  if ( !sTitle )
    sTitle = '';
  if( !iReturn )
    iReturn = false;

	if( !iWidth )
		var iWidth = 750;
	if( !iHeight )
		var iHeight = 530;

	if( +iWidth > 750 )
		iWidth = 750;
	else
		iWidth = +iWidth + 40;

	if( +iHeight > 530 )
		iHeight = 530
	else
		iHeight = +iHeight + 40;

	var iX = ( screen.availWidth - iWidth ) / 2;
	var iY = ( screen.availHeight - iHeight ) / 2;

  var refOpen = window.open( sAdres, sTitle, "height="+iHeight+",width="+iWidth+",top="+iY+",left="+iX+",resizable=yes,scrollbars=yes,status=0;" );

  if( iReturn == true )
  	return refOpen
}
