﻿function toggleLayer(whichLayer){
      if (document.getElementById) {
// this is the way the standards work
            var style2 = document.getElementById(whichLayer).style;
            style2.display = style2.display? "":"block";
      } else if (document.all) {
// this is the way old msie versions work
            var style2 = document.all[whichLayer].style;
            style2.display = style2.display? "":"block";
      } else if (document.layers) {
// this is the way nn4 works
            var style2 = document.layers[whichLayer].style;
            style2.display = style2.display? "":"block";
      }
}
/**/

var layer_id;
function popUpEditor() {

	layer_id = 'EditorDiv';	
	if (document.all){
		//alert('block');
		document.all[layer_id].style.display="block"
		document.all[layer_id].style.visibility="visible"
		}
	else
		//alert('show');
		if(document.layers){
		document.layers[layer_id].visibility="show"
		}

//	}
	
	layer_id = 'NormalDiv';
	if (document.all){
		//alert('hiding');
		document.all[layer_id].style.display="none"
		document.all[layer_id].style.visibility="hidden"
	}
	else
		if(parent.document.layers){
		document.layers[layer_id].visibility="hide"
		}
	
	document.getElementById('PopUpButton').innerHTML = '<a href="javascript:popUpNormal();">ללא עריכה</a>' ;
}
/**/
function popUpNormal() {

	layer_id = 'NormalDiv';	
	if (document.all){
		//alert('block');
		document.all[layer_id].style.display="block"
		document.all[layer_id].style.visibility="visible"
		}
	else
		//alert('show');
		if(document.layers){
		document.layers[layer_id].visibility="show"
		}
//	
	layer_id = 'EditorDiv';
	if (document.all){
		//alert('hiding');
		document.all[layer_id].style.display="none"
		document.all[layer_id].style.visibility="hidden"
	}
	else
		if(parent.document.layers){
		document.layers[layer_id].visibility="hide"
		}
		
	document.getElementById('PopUpButton').innerHTML = '<a href="javascript:popUpEditor();">עריכת תוכן</a>' ;	
}

/**/
var layer_id;
function popUpFooterEditor() {
	layer_id = 'FooterEditorDiv';	
	if (document.all){
		//alert('block');
		document.all[layer_id].style.display="block"
		document.all[layer_id].style.visibility="visible"
		}
	else
		//alert('show');
		if(document.layers){
		document.layers[layer_id].visibility="show"
		}

//	}
	
	layer_id = 'FooterNormalDiv';
	if (document.all){
		//alert('hiding');
		document.all[layer_id].style.display="none"
		document.all[layer_id].style.visibility="hidden"
	}
	else
		if(parent.document.layers){
		document.layers[layer_id].visibility="hide"
		}
	
	//document.getElementById('PopUpButton').innerHTML = '<a href="javascript:popUpNormal();">ללא עריכה</a>' ;
}
/**/
var layer_id;
function popUpFooterSubDiv(zCount) {
	layer_id = 'FooterSubDiv_' + zCount;	
	//alert(layer_id);
	if (document.all){
		//alert('block');
		document.all[layer_id].style.display="block"
		document.all[layer_id].style.visibility="visible"
		}
	else
		//alert('show');
		if(document.layers){
		document.layers[layer_id].visibility="show"
		}
	}


/**/

var layer_id;
function popUp(layer_id) {

if (parent.document.all[layer_id].style.visibility!="visible"){
	//alert('NOT visible');

	if (document.all){
		//alert('block');
		parent.document.all[layer_id].style.display="block"
		parent.document.all[layer_id].style.visibility="visible"
		}
	else
		//alert('show');
		if(document.layers){
		parent.document.layers[layer_id].visibility="show"
		}
	}	
/*
else
	{
	//alert(layer_id);
	
	if (parent.document.all){
		//alert('hiding');
		parent.document.all[layer_id].style.display="none"
		parent.document.all[layer_id].style.visibility="hidden"
	}
	else
		if(parent.document.layers){
		parent.document.layers[layer_id].visibility="hide"
		}
	}
*/		
}

function SC_Off(layer_id) {
	//alert(layer_id 'OFF');
	if (document.all){
		//alert('hiding');
		document.all[layer_id].style.display="none"
		document.all[layer_id].style.visibility="hidden"
	}
	else
	{
		if(document.layers){
		document.layers[layer_id].visibility="hide"
		}
	}
}
/**/
function LayerOff(layer_id) {
	//alert(layer_id 'OFF');
	if (parent.document.all){
		//alert('hiding');
		parent.document.all[layer_id].style.display="none"
		parent.document.all[layer_id].style.visibility="hidden"
	}
	else
	{
		if(parent.document.layers){
		parent.document.layers[layer_id].visibility="hide"
		}
	}
}
/**/
function FooterLayerOff(layer_id) {
	//alert(layer_id 'OFF');
	if (document.all){
		//alert('hiding');
		document.all[layer_id].style.display="none"
		document.all[layer_id].style.visibility="hidden"
	}
	else
	{
		if(parent.document.layers){
		document.layers[layer_id].visibility="hide"
		}
	}
}

function openItemInfoWin(url) {
			var ItemInfoWin = window.open(url, 'ColorChooser', 'resizable,width=550,height=410');
		}

function OpenPrintWindow(strUrl,zWidth,zHeight)
{
	//alert(strUrl);
	strWidthHeight = "resizable,left=100,top=30,width=" + zWidth + ",height=" + zHeight;
	window.open(strUrl,"PrintWindow",strWidthHeight);
}

/**/

function OpenSmartWindow(strUrl,zWidth,zHeight,zReferer)
{
	strUrl = strUrl + "&zReferer=" + zReferer;
	//alert(strUrl);
	strWidthHeight = "resizable,status,scrollbars,left=100,top=30,width=" + zWidth + ",height=" + zHeight;
	window.open(strUrl,"SmartWindow",strWidthHeight);
}

/**/
function OpenContactForm()
	{window.open("ContactForm.htm","ContactForm","scrollbars=NO,left=100,top=100,height=450,width=600");
	 return;}

function ShowPictureL(strUrl)
{
	window.open(strUrl,"LargePicture","status,left=0,top=0,height=250,width=300");
	return;}
/**/
function OpenTellAfriend()
	{window.open("TellAfriend.cfm","TellAfriend","left=100,top=100,height=300,width=350");
	 return;}
/**/

function ViewLetter(FullFileName)
	{
	//alert(FullFileName);
	window.open("OriginalPicture.cfm?FullFileName=" + FullFileName,"OriginalPicture","status=0,left=1,top=1,height=520,width=620");
	 return;}
/**/	

function OpenOriginalPicture(FullFileName)
	{window.open("../../OriginalPicture.cfm?FullFileName=" + FullFileName,"OriginalPicture","status=0,left=1,top=1,height=340,width=430");
	 return;}
/**/	 
function OpenSmartWin(strUrl)
{
	//alert(strUrl);
	window.open(strUrl,"SmartWindow","status,left=100,top=30,height=400,width=600");
}
/**/
function OpenFilezManager(strURL)
	{
		window.open(strURL,"FilesManager","status,left=200,top=30,height=600,width=800");
	 return;
	 }
/**/ 
function OpenLargePic(strUrl)
{
	alert(strUrl)
	window.open(strUrl,"PictureWindow","left=10,top=10,height=300,width=440")
} 
/**/
function ShowPreview(strPreview)
		{
			strImage = '<a href=JavaScript:OpenOriginalPicture("' + strPreview + '");><img src=' + strPreview + ' border=0 alt=" Click to open large photo "></a>'
			//alert(strImage);
			parent.mainFrame.document.getElementById("PreviewDiv").innerHTML = strImage;
		}
/**/		
function ShowGalleryPhoto(strGalleryPath,strFilename)
		{
			strImage = '<img id="_Ath_Slide" src=' + strGalleryPath + strFilename + ' hspace="0" vspace="0" border=0 alt=""  onload="OnImgLoad()">'
			//alert(strImage);
			document.getElementById("PreviewDiv").innerHTML = strImage;
			//<cfset CurrentFile=strFilename>
		}
/**/		
function ShowGalleryPhotoLink(strPreview)
		{
			strImage = '<a href=JavaScript:OpenOriginalPicture("' + strPreview + '");><img src=' + strPreview + ' border=0 alt=" Click to open large photo "></a>'
			//alert(strImage);
			document.getElementById("PreviewDiv").innerHTML = strImage;
		}
/**/		
function ShowDescription(strDescription,objAction,strActionName)
		{
		//alert(objAction)
		if (strDescription!=null)
		{
			document.getElementById("DescriptionDiv").innerHTML=strDescription;
		}
		
		if (strActionName != null)
		{
			//parent.leftFrame.location = 'left.cfm?action=' + strActionName + '&adminMode=#AdminMode#';
		
			var links=genLinks(objAction,strActionName);
		
			//alert(document.getElementById("zDiv"));
			if (document.getElementById("zDiv") != null)
			{
				document.getElementById("zDiv").innerHTML=links;
			}
		}
		//parent.leftFrame.document.getElementById("links").innerHTML ='';
		//parent.leftFrame.document.getElementById("zTable").innerHTML = links;
		//parent.leftFrame.document.getElementById("zDiv").innerHTML=links;
		}
		
//	Displays the 0 level Categories for a SECTION	
function genLinks(objLink,strActionName)
	{
		var linksArray = objLink.split("|");		
		var strLink,objArray;
		strLink='<table height="15" align="center" border="0" cellspacing="0" cellpadding="0" id="zTable" dir="rtl" lang="he" class="Top_SubLinks"><tr><TD height="15" width="50"><IMG src="images/spacer.gif" width="1" height="15" hspace="0" vspace="0" border="0" alt=""></td>';
		
		for (var i = 1;i<linksArray.length;i++)
		{
			objArray = linksArray[i].split('=');
			strLink += '<td align="center" nowrap"><a href="main.cfm?action=ShowDPCategory&table=Dp_' + strActionName + '_Cat&CatId=' + objArray[0] + '&actionName=' + strActionName +  '&adminMode=No" target="mainFrame" class="Top_SubLinks"><li>' + objArray[1] +'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li></a></td>'
		}
		strLink += '</tr></table>'
		//alert(strLink);
		return strLink;
		
	}
	