﻿<!--
/*
	Copyright Moty_p, http://WwW.MelonPortal.co.IL
	All Rights Reserved ©
*/
 
var PictureName;
var PictureURL;
var PictureType;
var PictureCopyright;

var NoteText = "Bad";

var ResolutionHeight;
var ResolutionWidth;
var ResolutionText;
var PictureInfo;
var WindowSize;

var FolderBoxSelect = "";
var SubMenuOptions;

var WindowHTML;
var HtmlChange;
var WindowZ = 1;

var DivHtmlInfo;
var DivStyleIE;
var DivStyleFF
var DoNotRush = "ok";

var objImg;
objImg = new Image();

var PicOC;
var DivOC;


function MenuChangeing(MenuPic,MenuDiv){
	PicOC = document.getElementById(MenuPic).src;
	DivOC = document.getElementById(MenuDiv).style.display;
	if (DivOC == "none"){
		ShowWindow(MenuDiv)
		document.getElementById(MenuPic).setAttribute("alt","סגור תפריט");
		document.getElementById(MenuPic).setAttribute("title","סגור תפריט");
		document.getElementById(MenuPic).src = "http:\/\/"+document.domain+"\/Images\/GFX\/BoxClose.gif";
	} else {
		CloseWindow(MenuDiv);
		document.getElementById(MenuPic).setAttribute("alt","פתח תפריט");
		document.getElementById(MenuPic).setAttribute("title","פתח תפריט");
		document.getElementById(MenuPic).src = "http:\/\/"+document.domain+"\/Images\/GFX\/BoxOpen.gif";

	};// End if
};// End Function

function Resolution(){
	ResolutionHeight = screen.height;
	ResolutionWidth = screen.width;
	ResolutionText = "Height = "+ResolutionHeight+" Width = "+ResolutionWidth;
	if (ResolutionHeight < 768 && ResolutionWidth < 1024){
			document.getElementById("ResolutionUseingText").innerHTML = "אתר זה נראה טוב ברזולוציה: <span class=\"RosewoodStdRegular\">1024*768<\/span> ומעלה.";
	} else {
		document.getElementById("ResolutionUseingText").style.display = "none";
	};// End if
	//setTimeout ("ChangePictrues()",10);
};// End Function

function LoadPictrue(){
	if(!objImg.complete){
		setTimeout("LoadPictrue()",100);
		document.getElementById('PictureLoad').style.display = "block";
	} else {
		document.getElementById('PictureLoad').style.display = "none";
	};// End if
};// End Functio

var Cookies = {
	Read: function(sName){
		if(navigator.appName=="Microsoft Internet Explorer"){
			//var sGetNames = document.cookie.split("&");
			var sGetNames = document.cookie.split(";");
		} else {
			var sGetNames = document.cookie.split(";");
		};// End if
		for(var i=0; i<sGetNames.length; i++){
			var iGetPos = sGetNames[i].search("=")+1;
			if(sGetNames[i].search(sName+"=") != (-1)) {
				return sGetNames[i].substring(iGetPos, sGetNames[i].length);
			};// End if
		};// End For
		return false;
	},// End Function Read
	
	Write: function(sName, sValue, iDays){
		var dCurrent = new Date();
		dCurrent.setTime(dCurrent.getTime()+(iDays*24*60*60*1000));
		var sExp = (iDays) ? "; expires="+dCurrent.toGMTString() : "";
		document.cookie = sName.concat("=", sValue, sExp, "; path=/");
	},// End Function Write
	
	Remove: function(sName){
		this.Write(sName, "", -1);
	}// End Function Remove
};// End Function Cookies

//alert(Cookies.Read("MeinMenu"));

function ChangePictrues(){
	 if (Cookies.Read("BG_ImageName") == false){
		PictureName = "AhsqlonBeach";
		PictureURL = ServerPlace+"Images\/Wallpaper";
		PictureType = "jpg";
		PictureCopyright = "Moty Perez";
		PictureInfo = "חוף הים של אשקלון בשקיעה";
	} else {
		PictureName = unescape(Cookies.Read("BG_ImageName"));
		PictureURL = ServerPlace+unescape(Cookies.Read("BG_ImageURL"));
		PictureType = unescape(Cookies.Read("BG_ImageType"));
		PictureCopyright = unescape(Cookies.Read("BG_ImageCopyright"));
		PictureInfo = unescape(Cookies.Read("BG_ImageInfo"));
	};// End if
	
	objImg.src = PictureURL+"\/"+ResolutionHeight+"X"+ResolutionWidth+"\/"+PictureName+"."+PictureType;
	
		document.body.style.backgroundImage = "url('"+PictureURL+"\/"+ResolutionHeight+"X"+ResolutionWidth+"\/"+PictureName+"."+PictureType+"')";
    document.body.style.backgroundRepeat = "no-repeat";
    document.body.style.backgroundPosition = "center top";
	
	setTimeout("LoadPictrue()",100);
	
	    document.getElementById("PictureCopyright").innerHTML = "על התמונת הרקע\: "+PictureInfo+"<br> זכויות יוצרים על תמונת הרקע\: "+PictureCopyright;
	
};// End Function

function CloseWindow(WindowDivID){
	document.getElementById(WindowDivID).style.display = "none";
};// End Function

function ShowWindow(WindowDivID){
	document.getElementById(WindowDivID).style.display = "block";
};// End Function

function TopWindow(WindowDivID){
	document.getElementById(WindowDivID).style.zIndex=WindowZ;
	WindowZ++;
};// End Function

function SetHomePage(objct){
	if(navigator.appName=="Microsoft Internet Explorer"){
		objct.style.behavior='url(#default#homepage)';
		objct.setHomePage('http://www.MelonPortal.co.IL');
	} else if (navigator.appName=="Netscape"){
		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
		prefs.setCharPref('browser.startup.homepage','http://www.MelonPortal.co.IL');
		
	} else if (navigator.appName=="Opera"){
		alert("אני מחפש סקריפט בשביל אופרה לקבוע את האתר לעמוד הבית, צריך עזרה כאן.");
	} else {
		alert("הדפדפן שלך אינו תומך בפונקציה.");
	};// End if
};// End Function

function PagesSubMenu(InfoFrom){
	//document.getElementById("SubMenuPages").innerHTML = document.getElementById(InfoFrom).innerHTML;
	$("#SubMenuPages").html($("#"+InfoFrom).html());
};// End Function

function PagesInfoMenu(InfoFrom){
	$("#InfoPages").html($("#"+InfoFrom).html());
};// End Function


function chkLang(str){
	if(str.charCodeAt(0)<1488 || str.charCodeAt(0)>1514){
		return "English"; // (Only English)
	} else {
		return "Hebrew"; // (Else)
	};// End if
};// End Function


function ShowLoadingText(DivOut){
	WindowHTML = "	<img class=\"MoveDown DefaultIcon\"  src=\"Images\/GFX\/loading.gif\" alt=\"רק רגע, טוען...\" title=\"רק רגע, טוען...\">\n"
	WindowHTML += "רק רגע, טוען...\n"
	//document.getElementById(DivOut).innerHTML = WindowHTML ;
	$("#"+DivOut).html(WindowHTML);
};// End Function

function WinBG(UserSelect){
	if (UserSelect == "Clear"){
		document.getElementById("WindowTitle").setAttribute("className", "legendX");
		document.getElementById("WindowTitle").setAttribute("class", "legendX");
		document.getElementById("WindowIDStyleing").setAttribute("className", "fieldsetX");
		document.getElementById("WindowIDStyleing").setAttribute("class", "fieldsetX");
		//document.getElementById("WindowIDStyleing").style.backgroundImage = "url('../Images/GFX/Lucidity.png')";
		//document.getElementById("WindowTitle").style.backgroundImage = "url('../Images/GFX/LucidityHard.png')";
		Cookies.Write('WindowBC','Clear',356);
	} else if (UserSelect == "Full"){
		document.getElementById("WindowTitle").setAttribute("className", "legendX2");
		document.getElementById("WindowTitle").setAttribute("class", "legendX2");
		document.getElementById("WindowIDStyleing").setAttribute("className", "fieldsetX2");
		document.getElementById("WindowIDStyleing").setAttribute("class", "fieldsetX2");
		//document.getElementById("WindowIDStyleing").style.backgroundImage = "url('../Images/GFX/whiter.gif')";
		//document.getElementById("WindowTitle").style.backgroundImage = "url('../Images/GFX/whiter.png')";
		//background-color: transparent;
		Cookies.Write('WindowBC','Full',356);
	};// End if
};// End Function
	
function Ajax(DivOut,Async,MetHod,PageCalling,DataToSend){
	if (DoNotRush == "ok"){
		if (window.XMLHttpRequest){
			AjaxObj = new XMLHttpRequest();
		} else {
			AjaxObj = new ActiveXObject("Microsoft.XMLHTTP");
		};// End if
		
		AjaxObj.open(MetHod,PageCalling,Async);
		AjaxObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		if (DataToSend){
			AjaxObj.send(DataToSend);
		};// End if
		ShowLoadingText(DivOut);
		if (Async == true){
		
			AjaxObj.onreadystatechange = function(){
				if (AjaxObj.readyState == 4 && AjaxObj.status == 200){
					document.getElementById(DivOut).innerHTML = (AjaxObj.responseText);
				};// End if
			};// End Function
			
		} else {
			document.getElementById(DivOut).innerHTML = (AjaxObj.responseText);
		};// End if
		DoNotRush = "wait";
		setTimeout("DoNotRush = 'ok'",700);
	};// End if
};// End Function

function AjaxQ(DivOut,Async,MetHod,PageCalling,DataToSend,LoadText){
	if (DoNotRush == "ok"){
		//alert("lol");
		if(LoadText=="UnDisplay"){
			//ShowLoadingText(DivOut);
		} else {
			ShowLoadingText(DivOut);
		};// End if
		$.ajax({
			type: MetHod,
			url: PageCalling,
			data: DataToSend,
			success: function(msg){
				$("#"+DivOut).html(msg);
			},
			error: function(msg){
				NoteText = "Bad";
				$("#"+DivOut).html("נוצרה שגיאה, אנא נסו שנית מאוחר יותר.");
			}
		});
		DoNotRush = "wait";
		setTimeout("DoNotRush = 'ok'",700);
	};// End if
}; //End Function

function MenuFunctions(PageName,WindowName,SetWidth,SetHeight,OverFlow){	
	HtmlChange = "<img src=\"Images\/GFX\/a2.gif\" alt=\"רקע מלא\" title=\"רקע מלא\" style=\"width:9px; height:9px;\" onclick=\"WinBG('Full');\">\n"
	HtmlChange +=WindowName+"\n"
	HtmlChange +=	"<img src=\"Images\/GFX/a1.gif\" alt=\"רקע שקוף\" title=\"רקע שקוף\" style=\"width:9px; height:9px;\" onclick=\"WinBG('Clear');\">\n"
	document.getElementById("WindowTitle").innerHTML = HtmlChange;
	if (SetWidth){
		document.getElementById("WindowIDStyleing").style.width = SetWidth;
	};// End if
	if (SetHeight){
		document.getElementById("WindowIDStyleing").style.height = SetHeight;
	};// End if
	
	
	if (OverFlow == "Yes"){
		document.getElementById("WindowBodyStyleing").style.overflowX = "hidden";
		document.getElementById("WindowBodyStyleing").style.overflowY = "scroll";
	} else {
		document.getElementById("WindowBodyStyleing").style.overflowX = "hidden";
		document.getElementById("WindowBodyStyleing").style.overflowY = "hidden";
	};// End if
	document.getElementById("WindowBodyStyleing").setAttribute("className", "rtl");
	document.getElementById("WindowBodyStyleing").setAttribute("class", "rtl");
	
	document.getElementById("WindowBodyStyleing").innerHTML = "";
	//document.getElementById("WindowBodyStyleing").innerHTML = GetXmlResponse("WindowID=WindowBodyStyleing",PageName,true);
	AjaxQ("WindowBodyStyleing",false,"POST",PageName,"WindowID=WindowBodyStyleing");
	//Ajax("WindowBodyStyleing",false,"POST",PageName,"WindowID=WindowBodyStyleing");
};// End Function

function DisplayWinBC(){
	if (Cookies.Read("WindowBC") == false || Cookies.Read("WindowBC") == "Clear" ){
		WinBG("Clear");
	} else {
		WinBG("Full");
	};// End if
};// End Function

var ShowFlash
function ShowFlashFiles(Width,Height,URL,Name,IDName,Clear){
	ShowFlash = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\""
	ShowFlash += "codebase=\"http:\/\/fpdownload.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=7,0,0,0\""
	ShowFlash += "style=\"width:"+Width+"; height:"+Height+";\" id=\""+Name+"\">"
	ShowFlash += "<param name=\"allowScriptAccess\" value=\"sameDomain\">"
	ShowFlash += "<param name=\"movie\" value=\""+URL+"\">"
	ShowFlash += "<param name=\"quality\" value=\"High\">"
	if (Clear == "Yes"){
		ShowFlash += "<param name=\"wmode\" value=\"transparent\">"
	};// End if
	ShowFlash += "<embed src=\""+URL+"\" quality=\"High\" style=\"width:"+Width+"; height:"+Height+";\""
	ShowFlash += "align=\"middle\" allowscriptaccess=\"sameDomain\" type=\"application/x-shockwave-flash\""
	ShowFlash += "pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\" wmode=\"transparent\">"
	ShowFlash += "</object>"
	
	;document.getElementById(IDName).innerHTML = ShowFlash
	$("#"+IDName).html(ShowFlash);
};// End Function

function Note(fun,data){
	if (fun == "Zise"){
		if (Cookies.Read("NoteWindowY") == false || Cookies.Read("NoteWindowX") == false ){
			document.getElementById("UserPrivetNotes2").style.left = "7px";
			document.getElementById("UserPrivetNotes2").style.top = "100px";
		} else {
			document.getElementById("UserPrivetNotes2").style.left = Cookies.Read("NoteWindowX")+"px";
			document.getElementById("UserPrivetNotes2").style.top = Cookies.Read("NoteWindowY")+"px";
		};// End if
		if (Cookies.Read("NoteWindowA") == false || Cookies.Read("NoteWindowA") == "no"){
			CloseWindow("UserPrivetNotes2");
		} else {
			ShowWindow("UserPrivetNotes2");
		};// End if
	} else if (fun == "BigZise"){
		if (Cookies.Read("NoteBigWindowY") == false || Cookies.Read("NoteBigWindowX") == false ){
			document.getElementById("UserPrivetNotes3").style.left = "7px";
			document.getElementById("UserPrivetNotes3").style.top = "100px";
		} else {
			document.getElementById("UserPrivetNotes3").style.left = Cookies.Read("NoteBigWindowX")+"px";
			document.getElementById("UserPrivetNotes3").style.top = Cookies.Read("NoteBigWindowY")+"px";
		};// End if
		if (Cookies.Read("NoteBigWindowA") == false || Cookies.Read("NoteBigWindowA") == "no"){
			CloseWindow("UserPrivetNotes3");
		} else {
			ShowWindow("UserPrivetNotes3");
		};// End if
	} else if (fun == "Close"){
		CloseWindow("UserPrivetNotes2");
		Cookies.Write('NoteWindowA','no',356);
	} else if (fun == "ResetSize"){
		document.getElementById("UserPrivetNotes2").style.left = "7px";
		document.getElementById("UserPrivetNotes2").style.top = "100px";
		Cookies.Write('NoteWindowY',7,356);
		Cookies.Write('NoteWindowX',100,356);
	//	alert("מיקום הפתק נאפס בהצלחה");
	} else if (fun == "ResetBigSize"){
		document.getElementById("UserPrivetNotes3").style.left = "7px";
		document.getElementById("UserPrivetNotes3").style.top = "100px";
		Cookies.Write('NoteBigWindowY',7,356);
		Cookies.Write('NoteBigWindowX',100,356);
	//	alert("מיקום הפתק נאפס בהצלחה");
	} else if (fun == "Open"){
		ShowWindow("UserPrivetNotes2");
		Cookies.Write('NoteWindowA','yes',356);
	} else if (fun == "OpenBig"){
		ShowWindow("UserPrivetNotes3");
		Cookies.Write('NoteBigWindowA','yes',356);
	} else if (fun == "CloseBig"){
		CloseWindow("UserPrivetNotes3");
		Cookies.Write('NoteBigWindowA','no',356);
	} else if (fun == "Update"){
		document.getElementById("NoteUpdate").innerHTML = "שומר מידע, המתן בבקשה.";
		//AjaxQ("GeneralNoteInfo",false,"POST","Notes\/AjaxFunction.asp","VD=UpdateSmall&Data="+escape(data),"UnDisplay");
		AjaxQ("NoteUpdate",false,"POST","Notes\/AjaxFunction.asp","VD=UpdateSmall&Data="+escape(data),"UnDisplay");
		setTimeout ("Note('UpdateTime')",2000);
	} else if (fun == "UpdateBig"){
		//AjaxQ("EventNoteInfo",false,"POST","Notes\/AjaxFunction.asp","VD=UpdateBig");
		document.getElementById("NoteBigUpdate").innerHTML = "אפשרות זאת תרם נפתחה";
	} else if (fun == "UpdateTime"){
		if (NoteText == "Good"){
			AjaxQ('NoteUpdate',false,'POST','Notes\/AjaxFunction.asp','VD=TimeAndDateShow','UnDisplay');
		};// End if
	};// End if
};// End Function

$(document).ready(function(){
	setTimeout ("Resolution()",10);
	setTimeout ("ChangePictrues()",10);
	$("a").click(function(event){
		//alert("Thanks for visiting!");
	});	
});

/*window.onload = function LoadFunctions(){
	setTimeout ("Resolution()",10);
	setTimeout ("ChangePictrues()",10);
};// End Function*/
//-->
