/************************************************************************************************************
*	DHTML modal dialog box
*
*	Created:						August, 26th, 2006
*	@class Purpose of class:		Display a modal dialog box on the screen.
*			
*	Css files used by this script:	modal-message.css
*
*	Demos of this class:			demo-modal-message-1.html
*
* 	Update log:
*
************************************************************************************************************/


/**
* @constructor
*/

DHTML_modalMessage = function()
{
	//My Vars
	var ModalType;
	var ModalType = '';	
	var PostedValues='';
	var AjaxFilename='';
	var AjaxCheckFormData='';
	var ModalStaticContent='';
	var ModalStaticContentTitle='';
	var ModalRedirectCondition='';
	//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
	var url;								// url of modal message
	var htmlOfModalMessage;					// html of modal message
	
	var divs_transparentDiv;				// Transparent div covering page content
	var divs_content;						// Modal message div.
	var iframe;								// Iframe used in ie
	var layoutCss;							// Name of css file;
	var width;								// Width of message box
	var height;								// Height of message box
	
	var existingBodyOverFlowStyle;			// Existing body overflow css
	var dynContentObj;						// Reference to dynamic content object
	var cssClassOfMessageBox;				// Alternative css class of message box - in case you want a different appearance on one of them
	var shadowDivVisible;					// Shadow div visible ? 
	var shadowOffset; 						// X and Y offset of shadow(pixels from content box)
	var MSIE;
		
	this.url = '';							// Default url is blank
	this.htmlOfModalMessage = '';			// Default message is blank
	this.layoutCss = '';	// Default CSS file
	//this.height = 312;						// Default height of modal message
	this.width = 820;						// Default width of modal message
	this.height = 500;						// Default height of modal message
	//this.height = '';						// Default height of modal message
	//this.width = '';						// Default width of modal message
	this.cssClassOfMessageBox = false;		// Default alternative css class for the message box
	this.shadowDivVisible = true;			// Shadow div is visible by default
	this.shadowOffset = 5;					// Default shadow offset.
	this.MSIE = false;
	this.ModalRedirectCondition='';
	if(navigator.userAgent.indexOf('MSIE')>=0) this.MSIE = true;
	

}

DHTML_modalMessage.prototype = {
	// {{{ setSource(urlOfSource)
    /**
     *	Set source of the modal dialog box
     * 	
     *
     * @public
	 setSource : function(urlOfSource,ModalType)
	{
		this.url = urlOfSource;
		this.ModalType=ModalType;
		
	}	
     */		
	setSource : function(ModalType)
	{
		this.ModalType=ModalType;
		//this.ModalStaticContent='';
		//this.ModalStaticContentTitle='';
		
	}
	,
	setRedirectPath : function(ModalStaticRedirectPath)
	{
		this.ModalRedirectCondition=ModalStaticRedirectPath;
		//this.ModalStaticContent='';
		//this.ModalStaticContentTitle='';
		
	}
	
	
	// }}}	
	,
	
	setModalStaticContent: function(ModalStaticContent_1)
	{
		
		this.ModalStaticContent=ModalStaticContent_1;
		
	}
	
	
	// }}}	
	,
	
	setModalStaticContentTitle: function(ModalStaticContentTitle)
	{
		
		this.ModalStaticContentTitle=ModalStaticContentTitle;
		
	}
	
	
	// }}}	
	,
	
	setAjaxFileNames : function(AjaxFilename,AjaxCheckFormData)
	{
		this.AjaxFilename=AjaxFilename; 
		this.AjaxCheckFormData=SiteAjaxFolder+AjaxCheckFormData;
	}	
	,
	// {{{ setHtmlContent(newHtmlContent)
    /**
     *	Setting static HTML content for the modal dialog box.
     * 	
     *	@param String newHtmlContent = Static HTML content of box
     *
     * @public	
     */		
	setHtmlContent : function(newHtmlContent)
	{
		this.htmlOfModalMessage = newHtmlContent;
		
	}
	// }}}		
	,
	// {{{ setSize(width,height)
    /**
     *	Set the size of the modal dialog box
     * 	
     *	@param int width = width of box
     *	@param int height = height of box
     *
     * @public	
     */		
	setSize : function(width,height)
	{
		
		if(width)this.width = width;
		if(height)this.height = height;		
	}
	// }}}		
	,		
	// {{{ setCssClassMessageBox(newCssClass)
    /**
     *	Assign the message box to a new css class.(in case you wants a different appearance on one of them)
     * 	
     *	@param String newCssClass = Name of new css class (Pass false if you want to change back to default)
     *
     * @public	
     */		
	setCssClassMessageBox : function(newCssClass)
	{
		this.cssClassOfMessageBox = newCssClass;
		if(this.divs_content){
			if(this.cssClassOfMessageBox)
				this.divs_content.className=this.cssClassOfMessageBox;
			else
				this.divs_content.className='modalDialog_contentDiv';	
		}
					
	}
	// }}}		
	,	
	// {{{ setShadowOffset(newShadowOffset)
    /**
     *	Specify the size of shadow
     * 	
     *	@param Int newShadowOffset = Offset of shadow div(in pixels from message box - x and y)
     *
     * @public	
     */		
	setShadowOffset : function(newShadowOffset)
	{
		this.shadowOffset = newShadowOffset
					
	}
	// }}}		
	,	
	// {{{ display()
    /**
     *	Display the modal dialog box
     * 	
     *
     * @public	
     */		
	display : function()
	{
		if(!this.divs_transparentDiv){
			this.__createDivs();
		}	
		
		// Redisplaying divs
		this.divs_transparentDiv.style.display='block';
		this.divs_content.style.display='block';
		this.divs_shadow.style.display='block';		
		if(this.MSIE)this.iframe.style.display='block';	
		this.__resizeDivs();
		
		/* Call the __resizeDivs method twice in case the css file has changed. The first execution of this method may not catch these changes */
		window.refToThisModalBoxObj = this;		
		setTimeout('window.refToThisModalBoxObj.__resizeDivs()',150);
		
		this.__insertContent();	// Calling method which inserts content into the message div.
		//this.__insertforgo();
	}
	// }}}		
	,
	// {{{ ()
    /**
     *	Display the modal dialog box
     * 	
     *
     * @public	
     */		
	setShadowDivVisible : function(visible)
	{
		this.shadowDivVisible = visible;
	}
	// }}}	
	,
	// {{{ close()
    /**
     *	Close the modal dialog box
     * 	
     *
     * @public	
     */		
	close : function()
	{
		//document.documentElement.style.overflow = '';	// Setting the CSS overflow attribute of the <html> tag back to default.
		
		if(document.getElementById('Table_Whole_Container')) 
			document.getElementById('Table_Whole_Container').innerHTMl='';
		/* Hiding divs */
		this.divs_transparentDiv.style.display='none';
		this.divs_content.style.display='none';
		this.divs_shadow.style.display='none';
		if(this.MSIE)this.iframe.style.display='none';
		
		
	}	
	// }}}	
	,
	// {{{ __addEvent()
    /**
     *	Add event
     * 	
     *
     * @private	
     */	
	 
	 setPostValues : function(PostValues) 
	{
		
		if(PostValues!='')
			this.PostedValues=PostValues;
		
	}	
	,
	addEvent : function(whichObject,eventType,functionName,suffix)
	{ 
	  if(!suffix)suffix = '';
	  if(whichObject.attachEvent){ 
	    whichObject['e'+eventType+functionName+suffix] = functionName; 
	    whichObject[eventType+functionName+suffix] = function(){whichObject['e'+eventType+functionName+suffix]( window.event );} 
	    whichObject.attachEvent( 'on'+eventType, whichObject[eventType+functionName+suffix] ); 
	  } else 
	    whichObject.addEventListener(eventType,functionName,false); 	    
	} 
	// }}}	
	,
	// {{{ __createDivs()
    /**
     *	Create the divs for the modal dialog box
     * 	
     *
     * @private	
     */		
	__createDivs : function()
	{
		// Creating transparent div
		this.divs_transparentDiv = document.createElement('DIV');
		this.divs_transparentDiv.className='modalDialog_transparentDivs';
		this.divs_transparentDiv.style.left = '0px';
		this.divs_transparentDiv.style.top = '0px';
		
		document.body.appendChild(this.divs_transparentDiv);
		// Creating content div
		this.divs_content = document.createElement('DIV');
		//this.divs_content.className = 'modalDialog_contentDiv';
		this.divs_content.id = 'DHTMLSuite_modalBox_contentDiv';
		this.divs_content.style.zIndex = 100000;
		
		if(this.MSIE){
			this.iframe = document.createElement('<div>');
			this.iframe.style.zIndex = 90000;
			this.iframe.style.position = 'absolute';
			document.body.appendChild(this.iframe);	
		}
			
		document.body.appendChild(this.divs_content);
		// Creating shadow div
		this.divs_shadow = document.createElement('DIV');
		this.divs_shadow.className = 'modalDialog_contentDiv_shadow';
		this.divs_shadow.style.zIndex = 95000;
		document.body.appendChild(this.divs_shadow);
		window.refToModMessage = this;
		this.addEvent(window,'scroll',function(e){ window.refToModMessage.__repositionTransparentDiv() });
		this.addEvent(window,'resize',function(e){ window.refToModMessage.__repositionTransparentDiv() });
		

	}
	// }}}
	,
	// {{{ __getBrowserSize()
    /**
     *	Get browser size
     * 	
     *
     * @private	
     */		
	__getBrowserSize : function()
	{
    	var bodyWidth = document.documentElement.clientWidth;
    	var bodyHeight = document.documentElement.clientHeight;
    	
		var bodyWidth, bodyHeight; 
		if (self.innerHeight){ // all except Explorer 
		 
		   bodyWidth = self.innerWidth; 
		   bodyHeight = self.innerHeight; 
		}  else if (document.documentElement && document.documentElement.clientHeight) {
		   // Explorer 6 Strict Mode 		 
		   bodyWidth = document.documentElement.clientWidth; 
		   bodyHeight = document.documentElement.clientHeight; 
		} else if (document.body) {// other Explorers 		 
		   bodyWidth = document.body.clientWidth; 
		   bodyHeight = document.body.clientHeight; 
		} 
		return [bodyWidth,bodyHeight];		
		
	}
	// }}}	
	,
	// {{{ __resizeDivs()
    /**
     *	Resize the message divs
     * 	
     *
     * @private	
     */	
    __resizeDivs : function()
    {
    	
    	var topOffset = Math.max(document.body.scrollTop,document.documentElement.scrollTop);

		if(this.cssClassOfMessageBox)
			this.divs_content.className=this.cssClassOfMessageBox;
		else
			this.divs_content.className='modalDialog_contentDiv';	
			    	
    	if(!this.divs_transparentDiv)return;
    	
    	// Preserve scroll position
    	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
    	var sl = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
    	
    	window.scrollTo(sl,st);
    	setTimeout('window.scrollTo(' + sl + ',' + st + ');',10);

    	this.__repositionTransparentDiv();
    	

		var brSize = this.__getBrowserSize();
		var bodyWidth = brSize[0];
		var bodyHeight = brSize[1];
    	
		
		if(this.width &&  this.height) {
      		this.divs_content.style.width = this.width + 'px';
    		this.divs_content.style.height= this.height + 'px'; 
		}
	
    	
    	// Creating temporary width variables since the actual width of the content div could be larger than this.width and this.height(i.e. padding and border)
    	var tmpWidth = this.divs_content.offsetWidth;	
    	var tmpHeight = this.divs_content.offsetHeight;
    	
    	
    	// Setting width and height of left transparent div
    	
    	this.divs_content.style.left = Math.ceil((bodyWidth - tmpWidth) / 2) + 'px';;
    	this.divs_content.style.top = (Math.ceil((bodyHeight - tmpHeight) / 2) +  topOffset) + 'px';
    	//this.divs_content.style.top  = 225+'px';
 		if(this.MSIE){
 			this.iframe.style.left = this.divs_content.style.left;
 			this.iframe.style.top = this.divs_content.style.top;
			//this.iframe.style.top = 225+'px';
 			this.iframe.style.width = this.divs_content.style.width;
 			this.iframe.style.height = this.divs_content.style.height;
 		}
 		
    	this.divs_shadow.style.left = (this.divs_content.style.left.replace('px','')/1 + this.shadowOffset) + 'px';
    	this.divs_shadow.style.top = (this.divs_content.style.top.replace('px','')/1 + this.shadowOffset) + 'px';
    	//this.divs_shadow.style.top = 225+'px';
		this.divs_shadow.style.height = tmpHeight + 'px';
    	this.divs_shadow.style.width = tmpWidth + 'px';
    	
    	
    	
    	if(!this.shadowDivVisible)this.divs_shadow.style.display='none';	// Hiding shadow if it has been disabled
    	
    	
    }
    // }}}	
    ,
	// {{{ __insertContent()
    /**
     *	Insert content into the content div
     * 	
     *
     * @private	
     */	    
    __repositionTransparentDiv : function()
    {
    	this.divs_transparentDiv.style.top = Math.max(document.body.scrollTop,document.documentElement.scrollTop) + 'px';
    	this.divs_transparentDiv.style.left = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft) + 'px';
		var brSize = this.__getBrowserSize();
		var bodyWidth = brSize[0];
		var bodyHeight = brSize[1];
    	this.divs_transparentDiv.style.width = bodyWidth + 'px';
    	this.divs_transparentDiv.style.height = bodyHeight + 'px';		
		   	
    }
	// }}}	
	,
	// {{{ __insertContent()
    /**
     *	Insert content into the content div
     * 	
     *
     * @private	
     */	
   /* __insertContent : function()
    {
		if(this.ModalType!='' && this.ModalStaticContent==''){	// url specified - load content dynamically
			ShowModalWindowContent('DHTMLSuite_modalBox_contentDiv',this.ModalType);
			//ShowModalWindowforgotcontent('DHTMLSuite_modalBox_contentDiv',this.ModalType);
		}
			
    }		
}*/
    __insertContent : function()
    {
		
		if(this.ModalType!='' && this.ModalStaticContent==''){	// url specified - load content dynamically
			ShowModalWindowContent('DHTMLSuite_modalBox_contentDiv',this.ModalType,this.PostedValues,this.AjaxFilename,this.AjaxCheckFormData);
		}
			else{	
				this.ModalStaticContent='<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td width="8" height="30"><img src="'+SiteImagePath +'boxes/modal/curve1.png" width="8" height="30" align="absmiddle"></td><td width="90%" background="'+SiteImagePath +'boxes/modal/curvebg.png"  class="WhiteNormalFont"><strong>'+this.ModalStaticContentTitle+'</strong></td><td width="10%" align="right" background="'+SiteImagePath +'boxes/modal/curvebg.png"><img src="'+SiteImagePath +'icons/close_grey.gif" alt="Close" align="absmiddle" border="0" onClick="closeMessage(\''+this.ModalRedirectCondition+'\');" onmouseover="this.src=\''+SiteGlobalPath+'images/icons/close_grey.gif\'" onmouseout="this.src=\''+SiteGlobalPath+'images/icons/close_grey.gif\'"style="cursor:pointer;" /></td><td width="8" height="30"><img src="'+SiteImagePath +'boxes/modal/curve2.png" width="8" height="30" align="absmiddle"></td></tr><tr bgcolor="#FFFFFF"><td width="8">&nbsp;</td><td  colspan="2"><div class="ContentLayer" style="width:'+this.width+'px;height:'+this.height+'px">'+this.ModalStaticContent+'</div></td><td width="8">&nbsp;</td></tr><tr><td width="8" height="19"><img src="'+SiteImagePath +'boxes/modal/curved1.gif" width="8" height="19" align="absbottom"></td><td colspan="2" bgcolor="#FFFFFF">&nbsp;</td><td width="8" height="19"><img src="'+SiteImagePath +'boxes/modal/curved2.gif" width="8" height="19" align="absbottom"></td></tr></table>';
				this.divs_content.innerHTML =this.ModalStaticContent;
		}
    }	
}
//////////////Common Variables

//var LoadingStatus='<img src="'+SiteImagePath+'">';
var LoadingStatusBar=""; 
var ModalStaticContent='';
var ModalStaticContentTitle='';
var ModalStaticRedirectPath='';
var ErrorInfoImg  ="";
var SuccessInfoImg="";
var edit_image   = "";
var valid_image  =SuccessInfoImg;
var invalid_image=ErrorInfoImg;
var invalid_mesg = 'In valid'; 
function LoadHelp(obj,fieldName,content) {
		if(content=='')
			content='Enter content here';
		RemoveLayer();
		ShowHelpLayer(obj,fieldName,'LoadHelp','',0,content,fieldName);
}
////////////////////////////////////////////////////////Modal Window Related Functions ////////////////////////////////////////////
	messageObj = new DHTML_modalMessage();	
	messageObj.setShadowOffset(5);	
	
var CategoryIdent = '';
var DisplayCatName = '';
	/*function ShowModalWindow(ModalType,width,height,PostValues,AjaxFilename,AjaxCheckFormData,CatIdent,CatName) {
			ModalStaticContent='';
			ModalStaticContentTitle='';
			ModalStaticRedirectPath='';
			messageObj.setModalStaticContentTitle(ModalStaticContentTitle);
			messageObj.setModalStaticContent(ModalStaticContent);
			messageObj.setRedirectPath(ModalStaticRedirectPath);
			messageObj.setAjaxFileNames(AjaxFilename,AjaxCheckFormData);
			messageObj.setSource(ModalType);
			messageObj.setPostValues(PostValues);
			messageObj.setCssClassMessageBox(false);
			messageObj.setSize(width,height);			
			messageObj.setShadowDivVisible(false);	// Enable shadow for these boxes
			messageObj.display();
	}
	
	function ShowModalWindowContent(ModalMasterID,ident,modeltype)
	{		    
	
		ModalMasterID_public=ModalMasterID;
		//document.getElementById(ModalMasterID).innerHTML = '<table align="center" height="100%" bgcolor="#CCCCCC" width="100%"><tr><td valign="top" align="center" >'+LoadingStatus+'</td></tr></table>';
		var success = function(t){ShowModalWindowCont_Complete(t,ModalMasterID);}
		var failure = function(t){ShowOnFailure(t);}
		//var url = "ajax/category-view.php"; 
		//var pars = "&op=GetCategory" + "&CategoryID=" + ident;
		//var pars = "&op1=index";
		//var pars = '&ModalTypeCondition='+ModalType;
		var url = 'ajax/category-view.php';//Filename;
		var pars = '&ModalTypeCondition='+ModalType+'&PostValues='+PostValues;
		
		var myAjax = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});
	}
	function ShowModalWindowCont_Complete(t,ModalMasterID)
	{		
	
		//alert(t.responseText);
		var strValue = t.responseText;
		//alert(ModalMasterID);
		document.getElementById(ModalMasterID).innerHTML =strValue;
	}
	*/
	
		/*function isEmailAddr(email,Label) {
			if(email=="") {alert(Label+ " Should not be Empty");return false}
			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
				return (true)
			}
			alert("Invalid "+Label+" Address! Please re-enter.")
			return (false)
		}
		function emailValidate(objForm)	{
			if(!isEmailAddr(document.getElementById('frmEmailAddress').value,"Email Address")) {
				document.getElementById('frmEmailAddress').focus();					
			}		
	  	 }*/

	
	
		function ShowModalWindow(ModalType,width,height,PostValues,AjaxFilename,AjaxCheckFormData) {
			
			ModalStaticContent='';
			ModalStaticContentTitle='';
			ModalStaticRedirectPath='';
			messageObj.setModalStaticContentTitle(ModalStaticContentTitle);
			messageObj.setModalStaticContent(ModalStaticContent);
			messageObj.setRedirectPath(ModalStaticRedirectPath);
			messageObj.setAjaxFileNames(AjaxFilename,AjaxCheckFormData);
			messageObj.setSource(ModalType);
			messageObj.setPostValues(PostValues);
			messageObj.setCssClassMessageBox(false);
			messageObj.setSize(width,height);			
			messageObj.setShadowDivVisible(false);	// Enable shadow for these boxes
			messageObj.display();
	}
	function ShowModalWindowContent(ModalMasterID,ModalType,PostValues,AjaxFilename,AjaxCheckFormData)
	{
		
		
		var Filename=AjaxFilename;	
		
		//if(Filename=='ajax/modal_window_new.phpajax/category-view.php'){
		//var Filename='ajax/category-view.php'}
		//else{
		//var Filename='ajax/members.php'}
		
		
		ModalMasterID_public=ModalMasterID;
		//document.getElementById(ModalMasterID).innerHTML = '<table align="center" height="100%"><tr><td colspan="2" valign="middle"  height=30 >'+LoadingStatus+'</td></tr></table>';
		var success = function(t){ShowModalWindowCont_Complete(t,ModalMasterID,ModalType,PostValues,AjaxFilename,AjaxCheckFormData);}
		var failure = function(t){ShowOnFailure(t);}
		//var url = 'ajax/members.php';//Filename;
		//var pars = '&ModalTypeCondition='+ModalType+'&PostValues='+PostValues;
		var url = Filename;//Filename;
		var pars = '&op='+ModalType+'&PostValues='+PostValues;
		var myAjax = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});
	}
	function ShowModalWindowCont_Complete(t,ModalMasterID,ModalType,PostValues,AjaxFilename,AjaxCheckFormData)
	{
		
		var strValue = t.responseText;
		document.getElementById(ModalMasterID).innerHTML =strValue;
	}
	
	
	
	function closeMessage(RedirectCondition)
	{		
		messageObj.close();	
		window.location.href = RedirectCondition;
	}
	function closeMessageLayer()
	{
		messageObj.close();			
	}
	
	function ShowOnFailure(t) { 
	     
		alert(t); 
		//alert("Comes Here");
	};
	
function checkThisImage(catImgId,hiddenId){
  
  if($(hiddenId).value =="no"){	
    $(hiddenId).value ="yes";
	$(catImgId).src = "images/chk.gif";
	return ;
  }
  if($(hiddenId).value =="yes"){
    $(hiddenId).value ="no";
	$(catImgId).src ="images/unchk.gif";
	return ;
  }
}
function selectAllCategory(){
  Catcount = $("totalCategory").value;
  for(i=1;i<Catcount;i++){
	 hiddenId = "categoryChecImgVal"+i;
	 catImgId = "categoryChecImg"+i;
	 $(hiddenId).value ="yes";
	 $(catImgId).src = "images/chk.gif";  
  }
}
function validateLayerSearch(){
   Catcount = $("totalCategory").value;
   strCatIdList ='';
   if(trim($("SearchLayerText").value)==""){
	  alert("search text should not be empty"); 
	  $("SearchLayerText").focus();
      return false; 
  }
  if(Catcount !=""){
     for(i=1;i<Catcount;i++){
		 hiddenId = "categoryChecImgVal"+i;
		 if($(hiddenId).value =="yes"){
			strCatIdList += $("CatIdent"+i).value+"###";
		 }
  	}
 
    if(strCatIdList==""){
		 alert("select at least one category");  
		 return false;  
    }
	$("LayerCategoryIdList").value = strCatIdList;
  }
  else{
    $("LayerCategoryIdList").value = Catcount = $("CatIdent").value;
  }
  
}	
//////////////////////////////////////show modal of index page///////////////
	messageObj = new DHTML_modalMessage();	
	messageObj.setShadowOffset(5);	
	
var CategoryIdent = '';
var DisplayCatName = '';
	function ShowModalWindowforgot(ModalType,width,height,PostValues,AjaxFilename,AjaxCheckFormData,CatIdent,CatName) {
			ModalStaticContent='';
			ModalStaticContentTitle='';
			ModalStaticRedirectPath='';
			messageObj.setModalStaticContentTitle(ModalStaticContentTitle);
			messageObj.setModalStaticContent(ModalStaticContent);
			messageObj.setRedirectPath(ModalStaticRedirectPath);
			messageObj.setAjaxFileNames(AjaxFilename,AjaxCheckFormData);
			messageObj.setSource(ModalType);
			messageObj.setPostValues(PostValues);
			messageObj.setCssClassMessageBox(false);
			messageObj.setSize(width,height);			
			messageObj.setShadowDivVisible(false);	// Enable shadow for these boxes
			messageObj.display();
	}
	
	function ShowModalWindowforgotcontent(ModalMasterID)
	{		    
	
		ModalMasterID_public=ModalMasterID;
		//document.getElementById(ModalMasterID).innerHTML = '<table align="center" height="100%" bgcolor="#333" width="100%"><tr><td valign="middle" align="center" >'+LoadingStatus+'</td></tr></table>';
		var success = function(t){ShowModalWindowCont_Complete(t,ModalMasterID);}
		var failure = function(t){ShowOnFailure(t);}
		//var url = "ajax/category-view.php"; 
		//var pars = "&op=index";
		
		var myAjax = new Ajax.Request(url, {method:'post',postBody:pars, onSuccess:success, onFailure:failure});
	}
	
/*	function ShowModalWindowCont_Complete(t,ModalMasterID)
	{		
		alert(t.responseText);
		var strValue = t.responseText;
		alert(ModalMasterID);
		document.getElementById(ModalMasterID).innerHTML =strValue;
	}*/
	
	function closeMessage(RedirectCondition)
	{		
		messageObj.close();	
		window.location.href = RedirectCondition;
	}
	function closeMessageLayer()
	{
		messageObj.close();			
	}
	
	function ShowOnFailure(t) { 
		//alert(t); 
		
	};
	
function checkThisImage(catImgId,hiddenId){
  
  if($(hiddenId).value =="no"){	
    $(hiddenId).value ="yes";
	$(catImgId).src = "images/chk.gif";
	return ;
  }
  if($(hiddenId).value =="yes"){
    $(hiddenId).value ="no";
	$(catImgId).src ="images/unchk.gif";
	return ;
  }
}

function selectAllCategory(){
  Catcount = $("totalCategory").value;
  for(i=1;i<Catcount;i++){
	 hiddenId = "categoryChecImgVal"+i;
	 catImgId = "categoryChecImg"+i;
	 $(hiddenId).value ="yes";
	 $(catImgId).src = "images/chk.gif";  
  }
}
function validateLayerSearch(){
   Catcount = $("totalCategory").value;
   strCatIdList ='';
   if(trim($("SearchLayerText").value)==""){
	  alert("search text should not be empty"); 
	  $("SearchLayerText").focus();
      return false; 
  }
  if(Catcount !=""){
     for(i=1;i<Catcount;i++){
		 hiddenId = "categoryChecImgVal"+i;
		 if($(hiddenId).value =="yes"){
			strCatIdList += $("CatIdent"+i).value+"###";
		 }
  	}
 
    if(strCatIdList==""){
		 alert("select at least one category");  
		 return false;  
    }
	$("LayerCategoryIdList").value = strCatIdList;
  }
  else{
    $("LayerCategoryIdList").value = Catcount = $("CatIdent").value;
  }
  
}	

