var colour; var htmlOn; function overIcon(iconItem){ iconItem.style.border='1px solid #000000'; iconItem.style.backgroundColor='#F5F5F5'; } function outIcon(iconItem){ iconItem.style.border='1px solid #eeeeee'; iconItem.style.backgroundColor='#eeeeee'; } function inserTags(strTag){ if(strTag == 'fieldset'){document.getElementById("message").contentWindow.document.body.innerHTML = document.getElementById("message").contentWindow.document.body.innerHTML + '
 
שם התרגיל
 
';} else{frames.message.document.body.innerHTML = frames.message.document.body.innerHTML + '

';} } //Function to format text in the text box function FormatText(command, option) { //Colour pallete if ((command == "forecolor") || (command == "backcolor")) { parent.command = command; buttonElement = document.getElementById(command); document.getElementById("message").contentWindow.focus() document.getElementById("colourPalette").style.left = getOffsetLeft(buttonElement) + "px"; document.getElementById("colourPalette").style.top = (getOffsetTop(buttonElement) + buttonElement.offsetHeight) + "px"; if (document.getElementById("colourPalette").style.visibility=="hidden") document.getElementById("colourPalette").style.visibility="visible"; else { document.getElementById("colourPalette").style.visibility="hidden"; } //get current selected range var sel = document.getElementById("message").contentWindow.document.selection; if (sel != null) { colour = sel.createRange(); } } //Text Format else { document.getElementById("message").contentWindow.focus(); document.getElementById("message").contentWindow.document.execCommand(command, false, option); document.getElementById("message").contentWindow.focus(); } } //Function to set colour function setColor(color) { document.getElementById("message").contentWindow.focus(); document.getElementById("message").contentWindow.document.execCommand(parent.command, false, color); document.getElementById("message").contentWindow.focus(); document.getElementById("colourPalette").style.visibility="hidden"; } //Function to add image function AddImage() { imagePath = prompt("כתוב את נתיב התמונה שברצונך להוסיף:", "http://"); if ((imagePath != null) && (imagePath != "")) { document.getElementById("message").contentWindow.focus() document.getElementById("message").contentWindow.document.execCommand("InsertImage", false, imagePath); } document.getElementById("message").contentWindow.focus() } //Function to switch to HTML view function HTMLview() { //WYSIWYG view if (htmlOn == true) { var html = document.getElementById("message").contentWindow.document.body.ownerDocument.createRange(); html.selectNodeContents(document.getElementById("message").contentWindow.document.body); document.getElementById("message").contentWindow.document.body.innerHTML = html.toString(); document.getElementById("ToolBar1").style.visibility="visible"; document.getElementById("ToolBar2").style.visibility="visible"; htmlOn = false; //HTML view } else { var html = document.createTextNode(document.getElementById("message").contentWindow.document.body.innerHTML); document.getElementById("message").contentWindow.document.body.innerHTML = ""; document.getElementById("message").contentWindow.document.body.appendChild(html); document.getElementById("ToolBar1").style.visibility="hidden"; document.getElementById("ToolBar2").style.visibility="hidden"; htmlOn = true; } } //Function to clear form function ResetForm() { if (window.confirm("האם אתה בטוח שברצונך לנקות את הטקסט ?")) { document.getElementById("message").contentWindow.focus() document.getElementById("message").contentWindow.document.body.innerHTML = ""; return true; } return false; } //Function to add smiley function AddSmileyIcon(imagePath){ document.getElementById("message").contentWindow.focus(); document.getElementById("message").contentWindow.document.execCommand("InsertImage", false, imagePath); } //Colour pallete top offset function getOffsetTop(elm) { var mOffsetTop = elm.offsetTop; var mOffsetParent = elm.offsetParent; while(mOffsetParent){ mOffsetTop += mOffsetParent.offsetTop; mOffsetParent = mOffsetParent.offsetParent; } return mOffsetTop; } //Colour pallete left offset function getOffsetLeft(elm) { var mOffsetLeft = elm.offsetLeft; var mOffsetParent = elm.offsetParent; while(mOffsetParent) { mOffsetLeft += mOffsetParent.offsetLeft; mOffsetParent = mOffsetParent.offsetParent; } return mOffsetLeft; } //Function to hide colour pallete function hideColourPallete() { document.getElementById("colourPalette").style.visibility="hidden"; }