<!-- hide this script from non-javascript-enabled browsers
/* Function that displays status bar messages. */
function MM_displayStatusMsg(msgStr)  { //v3.0
status=msgStr; document.MM_returnValue = true;
}

function MM_findObj(n, d) { //v3.0
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

/* Functions that swaps images. */
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function showUserPopup(URL, height, width)	
{
	day = new Date();
	id = day.getTime();
	//eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+ width + ",height=" + height + ",left = 400,top = 275');");
	var windowOpened = window.open(URL, id, "toolbar=1,scrollbars=0,location=0,statusbar=0,resizable=1,menubar=0,width="+ width + ",height=" + height + ",left = 0,top = 0");
	
	if (windowOpened.opener.name == window.name )	
		return true;
	else
		return false;
}

function selectLeftMenuElement(element) {
    element.className = 'LeftMenuLink-Selected';
}

function unselectLeftMenuElement(element) {
    element.className = 'LeftMenuLink-Unselected';
}

function gotoUrl(url) {
	window.location.href = url;
}
function goBack() {
	history.back();
}

	//*************All menu functions*******/
		function setClassToAllCells(RowToFormat, cssClassName) {
			var curCell;
			for (var i = 0; i < RowToFormat.cells.length; i++) {
				curCell = RowToFormat.cells[i];
				// more statements working with the cell
				curCell.className = cssClassName;
			}
		}
		function menuLink_mouseOver(menuItem_Row, cssClassName, hintText) {
			setClassToAllCells(menuItem_Row, cssClassName);
			setHint(hintText);
		}
		function menuLink_mouseOut(menuItem_Row, cssClassName) {
			setClassToAllCells(menuItem_Row, cssClassName);
		}
	//********************/
	//*************All textbox common functions*******/
		function  onBlur_Textbox(txtboxToFormat){
			txtboxToFormat.className = 'flat-input';
		}
		function  onFocus_Textbox(txtboxToFormat, hintText){
			txtboxToFormat.className = 'flat-input-onFocus';
			setHint(hintText);
		}
		function  onClick_Textbox(txtboxToFormat, hintText){
			onFocus_Textbox(txtboxToFormat, hintText);
		}
		function  onMouseOver_Textbox(txtboxToFormat){
		}
		function  onMouseOut_Textbox(txtboxToFormat){
		}
	//********************/
	//*************All button common functions*******/
		function  onBlur_Button(btnToFormat){
			btnToFormat.className = 'button-nosize';
		}
		function  onFocus_Button(btnToFormat){
			btnToFormat.className = 'button-nosize-onMouseOver';
		}
		function  onMouseOver_Button(btnToFormat){
			btnToFormat.className = 'button-nosize-onMouseOver';
		}
		function  onMouseOut_Button(btnToFormat){
			btnToFormat.className = 'button-nosize';
		}
	//********************/
	//*************All tab functions*******/
		function  onBlur_Tab(tabToFormat, cssClassName){
			tabToFormat.className = cssClassName;
		}
		function  onFocus_Tab(tabToFormat, cssClassName){
			tabToFormat.className = cssClassName;
		}
		function  onMouseOver_Tab(tabToFormat, cssClassName, hintText){
			tabToFormat.className = cssClassName;
			setHint(hintText);
		}
		function  onMouseOut_Tab(tabToFormat, cssClassName){
			tabToFormat.className = cssClassName;
		}
	//********************/
	//*************All hyperlink functions*******/
		function  onMouseOver_Link(LinkToFormat, cssClassName, hintText){
			LinkToFormat.className = cssClassName;
			setHint(hintText);
		}
		function  onMouseOut_Link(LinkToFormat, cssClassName){
			LinkToFormat.className = cssClassName;
		}
	//********************/
	//*************All hint functions*******/
		function setHint(hintText) {
			window.status = hintText;
			
			//document.getElementById("hint-text-box").innerText = hintText;
			document.all["hint-text-box"].innerHTML = hintText;
			//document.getElementById("hint-text-box").childNodes[0].nodeValue = hintText;
		}
	//********All System specific functions************/
		function searchReview(searchFor) {
			var url;
			url = "reviews.asp";
			document.forms[0].action = url;
			document.forms[0].method = 'post';
			document.forms[0].submit();
		}
		function DelReview(ReviewID, MovieName) {
			//if window.confirm("Are you sure you want to delete review named " + 
			//					MovieName + "? if you click on Ok or yes button then all the info about this review will be completely deleted " +
			//					" and wont get stored into the re-cyclebin, do you want to continue ?") {
			var confirm = window.confirm("Are you sure you want to delete review named " + 
								MovieName + "? if you click on Ok or yes button then all the info about this review will be completely deleted " +
								" and wont get stored into the re-cyclebin, do you want to continue ?");
			if (confirm) {
				var url;
				url = "View-Review.asp?ReviewID=" + ReviewID + "&Editable=True&Param_Btn_Del=True";
				gotoUrl(url);
			}
		}
        function Archive_UnArchive_Review(ReviewID, MovieName, ArchiveAction) {
			var url;
			url = "View-Review.asp?ReviewID=" + ReviewID + "&Editable=True&Param_ArchiveAction=" + ArchiveAction;
			gotoUrl(url);
		}
		function AddParagraphToReview(ReviewID) {
			var popUpShown = showUserPopup("Paragraph-Edit.asp?ID=-1&ReviewID=" + ReviewID, 570, 790);
			if (! popUpShown) {
				setHint("Either disable all your pop-up blockers or allow this site popups, otherwise the paragraph cant be added.");
			}
		}
		function AddLink(ReviewType) {
			var popUpShown = showUserPopup("link-edit.asp?ID=-1&type=" + ReviewType, 570, 790);
			if (! popUpShown) {
				setHint("Either disable all your pop-up blockers or allow this site popups, otherwise the link cant be added.");
			}
		}
		function EditParagraph(paraID, ReviewID) {
			var popUpShown = showUserPopup("Paragraph-Edit.asp?ID=" + paraID + "&ReviewID=" + ReviewID, 570, 790);
			if (! popUpShown) {
				setHint("Either disable all your pop-up blockers or allow this site popups, otherwise the paragraph cant be added.");
			}
		}
		function InsertParagraphBefore(before_paraSeqNo, ReviewID) {
			var popUpShown = showUserPopup("Paragraph-Edit.asp?ID=-1&Before_SeqNo=" + before_paraSeqNo + "&ReviewID=" + ReviewID, 570, 790);
			if (! popUpShown) {
				window.alert("Either disable all your pop-up blockers or allow this site popups, otherwise the paragraph cant be added.");
			}
		}
		function DelParagraph(URLforDel, ReviewID) {
			//if window.confirm("Are you sure you want to delete review named " + 
			//					MovieName + "? if you click on Ok or yes button then all the info about this review will be completely deleted " +
			//					" and wont get stored into the re-cyclebin, do you want to continue ?") {
			var confirm = window.confirm("Are you sure you want to delete this paragraph, if you continue you will loose all the details, continue ?");
			if (confirm) {
				var url;
				url = URLforDel;
				gotoUrl(url);
			}
		}
		function DelParagraphFromHomePage(URLforDel, ReviewID) {
			//if window.confirm("Are you sure you want to delete review named " + 
			//					MovieName + "? if you click on Ok or yes button then all the info about this review will be completely deleted " +
			//					" and wont get stored into the re-cyclebin, do you want to continue ?") {
			var confirm = window.confirm("Are you sure you want to delete this paragraph, if you continue you will loose all the details, continue ?");
			if (confirm) {
				var url;
				url = URLforDel;
				gotoUrl(url);
			}
		}
        function DelParagraphFromFestivalNowPlayingPage(URLforDel, ReviewID) {
			//if window.confirm("Are you sure you want to delete review named " + 
			//					MovieName + "? if you click on Ok or yes button then all the info about this review will be completely deleted " +
			//					" and wont get stored into the re-cyclebin, do you want to continue ?") {
			var confirm = window.confirm("Are you sure you want to delete this paragraph, if you continue you will loose all the details, continue ?");
			if (confirm) {
				var url;
				url = URLforDel;
				gotoUrl(url);
			}
		}
		function DelParagraphFromIndustryNewsPage(URLforDel, ReviewID) {
			//if window.confirm("Are you sure you want to delete review named " + 
			//					MovieName + "? if you click on Ok or yes button then all the info about this review will be completely deleted " +
			//					" and wont get stored into the re-cyclebin, do you want to continue ?") {
			var confirm = window.confirm("Are you sure you want to delete this paragraph, if you continue you will loose all the details, continue ?");
			if (confirm) {
				var url;
				url = URLforDel;
				gotoUrl(url);
			}
		}
		function getCurDateTimeAsDigits() {
		    var dtTime = new Date();
		    var curDateTime = '';
		    curDateTime = curDateTime + dtTime.getDay() 
		                    + '' + dtTime.getMonth()
		                    + '' + dtTime.getFullYear()
		                    + '' + dtTime.getHours()
		                    + '' + dtTime.getMinutes()
		                    + '' + dtTime.getSeconds()
		                    + '' + dtTime.getMilliseconds();
		                    
            return curDateTime;		                    
	    }
        function makeAjaxGETRequest(url)
        {
            if (url.indexOf('?') == -1) url = url + '?'; else url = url + '&';
            
            url = url + 'currenttime='+ getCurDateTimeAsDigits();
            
            var xmlHttp;
            try
            {
                // Firefox, Opera 8.0+, Safari
                xmlHttp=new XMLHttpRequest();
            }
            catch (e)
            {
                // Internet Explorer
                try
                {
                    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch (e)
                {
                    try
                    {
                        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    catch (e)
                    {
                      alert("Your browser does not support some features!");
                      return "";
                    }
                }
              }
            xmlHttp.open("GET",url,false);
            xmlHttp.send(null);

            return xmlHttp.responseText;
        }

function makeDynamicImageResizable(imgID) {
    if (document.getElementById(imgID).getAttribute('isresizable') == 'false') {
        document.getElementById(imgID).setAttribute('isresizable', 'true');

        $('#' + imgID).resizable({ 
                    handles: "all",
                    ghost: true,
                    autoHide:true,
                    minHeight:10, minWidth:10,
                    stop: function(e, ui){
                        var responseText = makeAjaxGETRequest('action-pages/update-image.asp?ByImageName=' + encodeURI(document.getElementById(imgID).getAttribute('name').replace('img_', '')) 
                                                                + '&ImageHeight=' + encodeURI(ui.size.height) + '&ImageWidth=' + encodeURI(ui.size.width) );
                                            
                        if (responseText=='success') {
                            window.alert('image dimentions saved successfully');
                        }
                        else{window.alert(responseText);}
                    }
                });
    }
}
// stop hiding -->
