/**
 * @author DS-OIPO
 * @package www.piekarnie.com.pl
 */ 


 
function OpenWindow(height,width,link) 
{
	New=window.open(link, '','toolbar=no,menubar=no,status=no,location=no,personalbar=no,scrollbars=yes,status=no,directories=no,resizable=no,height='+height+',width='+width); 
	New.focus();
}

function hideDiv(div_id) 
{
  var style_sheet = getStyleObject(div_id);
  if (style_sheet)
  {    
    changeObjectDisplay(div_id, "none");
  }
  else 
  {
    alert("sorry, this only works in browsers that do Dynamic HTML");
  }
}   

function showDivExclusive(div_id) 
{
	//alert("show");	
  var style_sheet = getStyleObject(div_id);
  if (style_sheet)
  {   	  	   
    changeObjectDisplay(div_id, "inline");
  }
  else 
  {
    alert("sorry, this only works in browsers that do Dynamic HTML");
  }
}

function getStyleObject(objectId) 
{
  // checkW3C DOM, then MSIE 4, then NN 4.
  //
  if(document.getElementById && document.getElementById(objectId)) 
  {
	return document.getElementById(objectId).style;
  }
  else if (document.all && document.all(objectId)) 
  {  
	return document.all(objectId).style;
  } 
  else if (document.layers && document.layers[objectId]) 
  { 
	return document.layers[objectId];
  } 
  else 
  {
	return false;
  }
}

function changeEmbedHeight(id, step, editBoxId)
{
	var object = document.getElementById(id);
	object.height = parseInt(object.height) + parseInt(step);
	var editBox = document.getElementById(editBoxId);
	editBox.value = object.height;
}


function changeObjectDisplay(objectId, newDisplay) {
    // first get the object's stylesheet
    var styleObject = getStyleObject(objectId);

    // then if we find a stylesheet, set its visibility
    // as requested
    //
    if (styleObject) {
	styleObject.display = newDisplay;
	return true;
    } else {
	return false;
    }
}

function hideAllDelayed()
{
	window.setTimeout('hideAll();',3000,"JavaScript");
}

function hideAll()
{
	changeObjectDisplay('subMenu_1', "none");
	changeObjectDisplay('subMenu_2', "none");
	changeObjectDisplay('subMenu_3', "none");
	changeObjectDisplay('subMenu_4', "none");
}

function switchDiv(objectId)
{
	var styleObject = getStyleObject(objectId);
	var destination;
	if (styleObject) 
	{
		if(styleObject.display == "none")
		{
			destination = "inline";
		}
		else
		{
			destination = "none";		
		}	
		hideAll();
		styleObject.display = destination;		
   } 
   else 
   {
		alert("sorry, this only works in browsers that do Dynamic HTML");
   }
}

function showDiv(div_id)
{
	//alert("show");	
  var style_sheet = getStyleObject(div_id);
  if (style_sheet)
  { 
  	hideAll();  	   
    changeObjectDisplay(div_id, "inline");
  }
  else 
  {
    alert("sorry, this only works in browsers that do Dynamic HTML");
  }
}



