function pressenterkey(evt,id)

{



    var key = (evt.which) ? evt.which : event.keyCode

    if(key==13)

	{

	   document.getElementById(id).focus();

	}

}





function GetXmlHttpObject()

{

	var xmlHttp=null;

	try

	{

		xmlHttp=new XMLHttpRequest();

	}

	catch(e)

	{

		try

		{

			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

		}

		catch(e)

		{

			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

		}

	}

	return xmlHttp;

}

/*********** Ajax Loader New *************/

function ProcessLoader()

{

	document.getElementById('dvprocessing').style.display = '';

}

/****************************************/

function CalculateTop(Height)

{

	var ScrollTop=document.body.scrollTop;

	if(ScrollTop==0)

	{

		if(window.pageYOffset)

			ScrollTop=window.pageYOffset;

		else

			ScrollTop=(document.body.parentElement)?document.body.parentElement.scrollTop:0;

	}



	var BodyHeight=document.body.clientHeight;



	if(BodyHeight==0)

	{

		BodyHeight=window.innerHeight;

	}

	if(BodyHeight==0)

	{

		BodyHeight=document.documentElement.clientHeight

	}



	var myWidth = 0, myHeight = 0;

  	if( typeof( window.innerWidth ) == 'number' )

	{

		//Non-IE

		myWidth = window.innerWidth;

		myHeight = window.innerHeight;

	}

	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )

	{

    //IE 6+ in 'standards compliant mode'

		myWidth = document.documentElement.clientWidth;

		myHeight = document.documentElement.clientHeight;

	}

	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )

	{

		//IE 4 compatible

		myWidth = document.body.clientWidth;

		myHeight = document.body.clientHeight;

	}

	var FinalTop=((myHeight-Height)/2)+ScrollTop;

	return FinalTop;

}

function CalculateLeft(Weight)

{

	var ScrollLeft=document.body.scrollLeft;



	if(ScrollLeft==0)

	{

		if(window.pageXOffset)

			ScrollLeft=window.pageXOffset;

		else

			ScrollLeft=(document.body.parentElement)?document.body.parentElement.scrollLeft:0;

	}



	var BodyWeight=document.documentElement.clientWidth;



	if(BodyWeight==0)

	{

		BodyWeight=document.body.clientWidth;

	}



	var FinalLeft=(BodyWeight+ScrollLeft-Weight)/2;



	return FinalLeft;

}



/***************** Setting the Dimmer while loading *********************/


function hideIframe()

{

	

    if(ie)

    {
        var theIframe=document.getElementById("fadeboxiframe")

		

        if(theIframe!=null)

        {

            theIframe.style.display="none";

        }

    }

}



function SetBackground()

{

	document.getElementById('dimmer').style.width=GetBodyWidth();

	document.getElementById('dimmer').style.height=GetBodyHeight();

//	document.getElementById('dimmer').style.width  = "1364px";

//	document.getElementById('dimmer').style.height = "1003px";

	document.getElementById('dimmer').style.visibility="visible";

}

function UnsetBackground()

{

	document.getElementById('dimmer').style.width=0;

	document.getElementById('dimmer').style.height=0;

	document.getElementById('dimmer').style.visibility="";	

	//document.getElementById('dvprocessing').style.display = 'none';

	//unhideIframe();

}



function unhideIframe()

{

	if(ie)

	{

		var theIframe=document.getElementById("fadeboxiframe")

		var theDiv=document.getElementById("dvregisterfrm");

		theIframe.style.width=theDiv.offsetWidth+'px';

		theIframe.style.height=theDiv.offsetHeight+'px';

		theIframe.style.top=theDiv.offsetTop+'px';

		theIframe.style.left=theDiv.offsetLeft+'px';

		theIframe.style.display='';

	}

}



/***********************************************************************/



function GetBodyWidth()

{

	var theWidth=0;

	if(document.body)

	{

		theWidth=document.body.clientWidth;

	}

	else if(document.documentElement&&document.documentElement.clientWidth)

	{

		theWidth=document.documentElement.clientWidth;

	}

	else if(window.innerWidth)

	{

		theWidth=window.innerWidth;

	}



	theWidth=theWidth-80;



	return theWidth+ "px";

}



function GetBodyHeight()

{		

	var theHeight1=0;

	var theHeight2=0;

	var theHeight3=0;

	

	//alert(window.innerHeight);

	if(window.innerHeight)

	{

		theHeight1=window.innerHeight;

	}

	

	if(document.documentElement&&document.documentElement.clientHeight)

	{

		//alert(document.documentElement.clientHeight);

		theHeight2 = document.documentElement.clientHeight;

	}

	/*if(document.body)

	 {

       theHeight3=document.body.clientHeight;

		if(isMozilla)

		{   

		  var theHeight4 = 0;

		}

		else

		{

			theHeight4=document.body.scrollHeight;

		}

	}*/

	FinalHeight=Math.max(theHeight1,theHeight2,theHeight3);

	FinalHeight=FinalHeight-70;

	return FinalHeight+ "px";

}



// Bind the Grid On Action of Paging,Searching,Sorting - Atul 03042010

function SendGridBindRequest(url,targetdiv,action,chkidfordelete,flgdisorder)

{
//alert(url);
	xmlHttp = GetXmlHttpObject();

    if(xmlHttp != null)

	{

	//alert(xmlHttp.readyState);

        xmlHttp.onreadystatechange = function()

		{

			if(xmlHttp.readyState==1)

			{

				// ProcessLoader();

				//SetBackground();

			}

			

			if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))

			{

				

				var str =  trim(xmlHttp.responseText);

				//alert(str);

			/*	var delarr;

				delarr=str.split("?");

				//alert('del[0]:'+delarr[0]);

				

				if(delarr[0]=='0')

				{

					

					action='none';

				}*/

				

				//alert(action);

				document.getElementById(targetdiv).innerHTML = '';

				document.getElementById(targetdiv).innerHTML = str;

				

				//UnsetBackground();

	/*			document.getElementById('dimmer').style.width=0;

				document.getElementById('dimmer').style.height=0;

				document.getElementById('dimmer').style.visibility="";

				document.getElementById('dvprocessing').style.display = 'none';*/

				

				

				

				switch(action)

				{

					case 'S': // to set the focus on the search text field

						document.getElementById('searchtxt1').focus();

						break;

					case 'Gtop': // to set the focus on the go to page text field on top

						document.getElementById('txtgotopagetop').focus();

						break;

					case 'Gbottom': // to set the focus on the go to page text field on bottom

						document.getElementById('txtgotopagebottom').focus();

						break;

					case 'D': // This is when the delete button is clicked

						

						alert("Records deleted successfully.");

						break;

					case 'none': // This is for delete ids directly passed

						alert("No Records deleted .");

						break;

					case 'PS': //This is for for focusing display select box

						 var position = trim(document.getElementById('position').value);

						 document.getElementById('cmbdisplay'+position).focus();

						 break;

					case 'FT':

						 document.getElementById('filterbytop').focus();

					case 'FB':

						document.getElementById('filterbybottom').focus();

						 break;
                    case 'PTG':
                        
                        $(document).ready(function() {
                                //$('div.zoom a').fancyZoom({scaleImg: true, closeOnClick: true});
                                setupZoom();
                            });
						 break;
						 

				}

			}

		};

		

        var appendurl = '';

        switch(action)

        {

            case 'PS':

					

			 	 var position = trim(document.getElementById('position').value);

				 var pagesize = trim(document.getElementById('cmbdisplay'+position).value);

				 

				// if(pagesize == '0')

				 appendurl = '&pagesize='+pagesize;

				 

				 break;

			

			

			case 'S': // This is for search

                var searchtxt = trim(document.getElementById('searchtxt1').value);

                

				

				/*if( searchtxt == '')

                {

                    alert("Please enter search text");

                    document.getElementById('searchtxt').focus();

                    return false;

                }*/

                var searchby = document.getElementById('searchby').value;

                appendurl = '&searchby='+searchby+'&searchtxt='+searchtxt;

			

                break;

				

            case 'FT': // This is for filter

				

				var filterby = trim(document.getElementById('filterbytop').value);

                appendurl = '&filterby='+filterby;



                break;

				

			 case 'FB': // This is for filter

				

				var filterby = trim(document.getElementById('filterbybottom').value);

                appendurl = '&filterby='+filterby;



                break;

				

            case 'Gtop': // This is for go to page text field top

                

				var noofpages = trim(document.getElementById('hdnnoofpages').value);

                var enteredpageno = trim(document.getElementById('txtgotopagetop').value);

                if(enteredpageno == '' || enteredpageno == 0)

                {

                    alert("Please enter page number.");

                    document.getElementById('txtgotopagetop').focus();

                    return false;

                }

                else if(parseInt(enteredpageno) > parseInt(noofpages))

                {

                    alert("Please enter proper page number.");

                    document.getElementById('txtgotopagetop').focus();

                    return false;

                }

                appendurl = '&pagenumber='+enteredpageno;

                break;

				

             case 'Gbottom': // This is for go to page text field bottom

              

			   var noofpages_2 = trim(document.getElementById('hdnnoofpages').value);

                var enteredpageno_2 = trim(document.getElementById('txtgotopagebottom').value);

                if(enteredpageno_2 == '')

                {

                    alert("Please enter page number.");

                    document.getElementById('txtgotopagebottom').focus();

                    return false;

                }

                else if(parseInt(enteredpageno_2) > parseInt(noofpages_2))

                {

                    alert("Please enter proper page number.");

                    document.getElementById('txtgotopagebottom').focus();

                    return false;

                }

                appendurl = '&pagenumber='+enteredpageno_2;

                break;

				

             case 'D': // This is for delete

			       

	             

                var chkelements = document.getElementsByName(chkidfordelete);

                var ids = "";

                var countChecked = 0;

                for(var i = 0; i < chkelements.length; i++)

                {

                    if(chkelements.item(i).checked == true)

                    {

                        countChecked++;

                        if(ids != "")

                           ids += ",";

                        ids += chkelements.item(i).value;

                    }

                }

                if(countChecked == 0)

                {

                    alert(" Please select atleast one record for delete.");

                    return false;

                }

                if(!confirm('This will delete the selected records.Are you sure you want to continue?'))

                {

                    return false;

                }

				//alert(ids);

                var totalpagerecords = document.getElementById('ptrecords').value;

				

                appendurl = '&action=delete&ptotalr='+totalpagerecords+'&dids='+ids;

				

				break;

				

			case 'Delids': // This is for delete ids directly passed

			       

	            var ids=chkidfordelete;

				var totalpagerecords = document.getElementById('ptrecords').value;

             	

                appendurl = '&action=delete&ptotalr='+totalpagerecords+'&dids='+ids;

				

				break;
                       case 'CMB':

                             var cmbvalue = document.getElementById('frmYear').value;
                             appendurl = "&type=srch&cmbvalue="+cmbvalue;
                             //alert(url);
                           
                       break;
				

			case 'AP': // This is for approve in grid

					 appendurl = '&QT=4';

			break;

			

			case 'DISP': // This is for display in grid

					 appendurl = '&action=display&QT=5';

			break;

			

			case 'CACHE': // This is for display in grid

					 appendurl = '&action=cache&QT=5';

			break;

			

			case 'DEFAULT': // This is for display in grid

					 appendurl = '&action=setdefault&QT=5';

			break;

			

			case 'QEDIT': // This is for quick edit in grid

					var quickfields = new Array();

					var varname = new Array();

					quickfields = chkidfordelete.split(',');

        			for(i=0;i<quickfields.length;i++)

					{

						varname[i] = document.getElementById(quickfields[i]).value;

					}

					 appendurl = '&QT=6&varname='+varname+'';

			break;

			

			case 'APR': // This is for approve rating in grid

					 appendurl = '&QT=7';

			break;

			

			case 'DO': // This is for bulk display order in grid

					var totalrows = document.getElementById('ptrecords').value;

					var ids = "";

					var values = "";

					var oldvalues = "";

					var commonglcode = "";

					

					var elementforid = "";

					var elementforvalues = "";

					var elementforoldvalues = "";

					var elementforcommonglcodes = "";

					

					for(var i = 0; i < totalrows; i++)

					{

						if(ids != "")

							ids += ",";

							

						if(values != "")

							values += ",";

							

						if(oldvalues != "")

							oldvalues += ",";

						

						elementforid = "hdnintglcode" + i;

						elementforvalues = "displayorder" + i;

						elementforoldvalues = "hdndisplayorder" + i;

						

						if(document.getElementById(elementforvalues).value == "")

						{

							alert("Field(s) cannot be left blank.");

							document.getElementById(elementforvalues).focus();

							return;

						}

						if(document.getElementById(elementforvalues).value == "0")

						{

							alert("Display order cannot be zero");

							document.getElementById(elementforvalues).focus();

							return;

						}

						

						ids += document.getElementById(elementforid).value;

						values += document.getElementById(elementforvalues).value;

						oldvalues += document.getElementById(elementforoldvalues).value;



                        if(flgdisorder)

                        {

						   if(commonglcode != "")

								commonglcode += ",";

						 

						   elementforcommonglcodes = "hdncommonglcode" + i;

						   commonglcode += document.getElementById(elementforcommonglcodes).value;

							

                        }

					}

					appendurl = '&task=orderupdate&uids='+ids+'&uvals='+values+'&uoldvals='+oldvalues+'&cmnglcode='+commonglcode;

					

			break;

			case 'MUS': // This is for music in event category grid

					 appendurl = '&QT=9';

					 

			break;

			case 'ORDSTATUS': // This is for Order Status Combo

			         appendurl = '&QT=10&ordstatusglcode='+chkidfordelete;

				     //alert(appendurl);

					 

			break;

			case 'RECMD': // This is for Pinstripe Recommended Combo

			         appendurl = '&QT=11';

					 

			break;

			case 'NEWSLET': // This is for Newsletter

			         appendurl = '&QT=12';

			break;

			

	    }	

		//alert(url + '&ajax=Y'+appendurl);  exit;

		xmlHttp.open('GET', url + '&ajax=Y'+appendurl, true);

		xmlHttp.send(null);

	}

	else

	{

		alert("Your browser does not support HTTP Request");

	}

    return true;

}

// End Of Bind the Grid - Atul 03042010



//Check delete bus in use or not!!

function checkDeleteExist(url,targetdiv,action,chkidfordelete,flgdisorder)

{

	xmlHttp = GetXmlHttpObject();

    if(xmlHttp != null)

	{

		xmlHttp.onreadystatechange = function() 

		{

			if(xmlHttp.readyState==1)

			{

				 ProcessLoader();

			}

			if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))

			{

				

				var str =  trim(xmlHttp.responseText);

				

				document.getElementById(targetdiv).innerHTML = '';

				document.getElementById(targetdiv).innerHTML = str;

				document.getElementById('dimmer').style.width=0;

				document.getElementById('dimmer').style.height=0;

				document.getElementById('dimmer').style.visibility="";

				document.getElementById('dvprocessing').style.display = 'none';

				

				alert("Records deleted successfully.");

					

			}

		};

        var appendurl = '';

	   

	    var chkelements = document.getElementsByName(chkidfordelete);

		var ids = "";

		var countChecked = 0;

		for(var i = 0; i < chkelements.length; i++)

		{

			if(chkelements.item(i).checked == true)

			{

				countChecked++;

				if(ids != "")

				   ids += ",";

				ids += chkelements.item(i).value;

			}

		}

		if(countChecked == 0)

		{

			alert(" Please select atleast one record for delete.");

			return false;

		}

		

		var totalpagerecords = document.getElementById('ptrecords').value;

		

		appendurl = '&QT=3&ptotalr='+totalpagerecords+'&dids='+ids;

		//alert(url + '&ajax=Y'+appendurl);

		

		xmlHttp.open('GET', url + '&ajax=Y'+appendurl, true);

		xmlHttp.send(null);

	}

	else

	{

		alert("Your browser does not support HTTP Request");

	}

    return true;

}





// Common function for updating a star

function UpdateStar(tablename, fieldname,intglcode)

{

	xmlHttp = GetXmlHttpObject();

	if (xmlHttp == null)

	{

		alert ("Your browser does not support XMLHTTP!");

		return;

	}

	

    var path=document.getElementById('star-'+intglcode).src;

    var file_a= path.substring(path.lastIndexOf("/")+1,path.length);

    var value;

    if(file_a == 'gstar.png')

    {

        value = 'N';

    }

    else if(file_a == 'gstar-disable.png')

    {

        value = 'Y';

    }

	

	var url = "index.php?ajax=Y&tablename="+tablename+"&fieldname="+fieldname+"&value="+value+"&id="+intglcode;

	

  //  var url = "commanajax.php?method=updatefield&tablename="+tablename+"&fieldname="+fieldname+"&value="+value+"&id="+intglcode;

	xmlHttp.onreadystatechange = function()

	{

		if(xmlHttp.readyState==1)

		{

			 //ProcessLoader();

			  SetBackground();

		}

		if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))

		{

			var result = xmlHttp.responseText;

			if(result == 1)

			{

				if(value == 'Y')

				{

				   document.getElementById('star-'+intglcode).src = 'html/images/gstar.png';

				   //document.getElementById('star-'+intglcode).onclick = function(){UpdateStar('pst_restaurant','chrstar','N',intglcode);};

				}

				else

				{

				   document.getElementById('star-'+intglcode).src = 'html/images/gstar-disable.png';

				   //document.getElementById('star-'+intglcode).onclick = function(){UpdateStar('pst_restaurant','chrstar','Y',intglcode);};

	

				}

			}

			else

			{

				alert("Sorry could not update...");

			}

			

			UnsetBackground();

		/*	document.getElementById('dimmer').style.width=0;

			document.getElementById('dimmer').style.height=0;

			document.getElementById('dimmer').style.visibility="";

			document.getElementById('dvprocessing').style.display = 'none';*/

		}

	};

	xmlHttp.open("GET",url,true);

	xmlHttp.send(null);

}

// End Of Common function for updating star







// Common function for updating publish

function UpdatePublish(tablename, fieldname,intglcode)

{

	xmlHttp = GetXmlHttpObject();

	if (xmlHttp == null)

	{

		alert ("Your browser does not support XMLHTTP!");

		return;

	}

	

    var path=document.getElementById('tick-'+intglcode).src;

    var file_a= path.substring(path.lastIndexOf("/")+1,path.length);

    var value;

    if(file_a == 'tick.png')

    {

        value = 'N';

    }

    else if(file_a == 'tick_cross.png')

    {

        value = 'Y';

    }

	

	var url = "index.php?ajax=Y&tablename="+tablename+"&fieldname="+fieldname+"&value="+value+"&id="+intglcode;

	

  //  var url = "commanajax.php?method=updatefield&tablename="+tablename+"&fieldname="+fieldname+"&value="+value+"&id="+intglcode;

	xmlHttp.onreadystatechange = function()

	{

		if(xmlHttp.readyState==1)

		{

			 //ProcessLoader();

			  SetBackground();

		}

		if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))

		{

			var result = xmlHttp.responseText;

			

		//	alert(document.getElementById('tick-'+intglcode));

			

			if(result == 1)

			{

				if(value == 'Y')

				{

				   document.getElementById('tick-'+intglcode).src = 'html/images/tick.png';

				   //document.getElementById('star-'+intglcode).onclick = function(){UpdateStar('pst_restaurant','chrstar','N',intglcode);};

				}

				else

				{

				   document.getElementById('tick-'+intglcode).src = 'html/images/tick_cross.png';

				   //document.getElementById('star-'+intglcode).onclick = function(){UpdateStar('pst_restaurant','chrstar','Y',intglcode);};

				}

			}

			else

			{

				alert("Sorry could not update...");

			}

			

			UnsetBackground();

		/*	document.getElementById('dimmer').style.width=0;

			document.getElementById('dimmer').style.height=0;

			document.getElementById('dimmer').style.visibility="";

			document.getElementById('dvprocessing').style.display = 'none';*/

		}

	};

	xmlHttp.open("GET",url,true);

	xmlHttp.send(null);

}

// End Of Common function for updating publish











function updatereadstar(cmbid,tablename,chkidfordelete)

{

	if(document.getElementById(cmbid).value == '0')

        return false;

    xmlHttp = GetXmlHttpObject();

	if (xmlHttp == null)

	{

		alert ("Your browser does not support XMLHTTP!");

		return;

	}

    var chkelements = document.getElementsByName(chkidfordelete);

    

	var ids = "";

    var countChecked = 0;

    for(var i = 0; i < chkelements.length; i++)

    {

		if(chkelements.item(i).checked == true)

        {

            countChecked++;

            if(ids != "")

               ids += ",";

            ids += chkelements.item(i).value;

        }

    }

    if(countChecked == 0)

    {

        alert(" Please select atleast one record for change.");

        document.getElementById('cmbmoreactiontop').value = '0';

		//document.getElementById('cmbmoreactionbottom').value = '0';

        return false;

    }

    

    var cmboption = document.getElementById(cmbid).value;

    var fieldname;

    var value;

    switch(cmboption)

    {

        case 'r': // To Mark As Read

            fieldname = 'chr_read';

            value = 'Y';

            break;

        case 'ur': // To Mark As UnRead

            fieldname = 'chr_read';

            value = 'N';

            break;

        case 'as': // Too Add Star

            fieldname = 'chr_star';

            value = 'Y';

            break;

        case 'rs': // Too Remove Star

            fieldname = 'chr_star';

            value = 'N';

            break;

        

    }

    var url = "index.php?ajax=Y&tablename="+tablename+"&fieldname="+fieldname+"&value="+value+"&id="+ids;

	

	xmlHttp.onreadystatechange = function(){

	if(xmlHttp.readyState==1)

	{

		 //ProcessLoader();

		 SetBackground();

	}

	if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))

	{

		var result = xmlHttp.responseText;

		var idarray = ids.split(',');

		var classname ;

		var classarray ;

		var finalclassname;

		

		if(result == 1)

		{

			if(value == 'Y' && fieldname == 'chr_star')

			{

					for ( var i=0, len=idarray.length; i<len; ++i ){

					   

						document.getElementById('star-'+idarray[i]).src = 'html/images/gstar.png';

					}

			}

			else if(value == 'N' && fieldname == 'chr_star')

			{

					for ( var i=0, len=idarray.length; i<len; ++i ){

					

						document.getElementById('star-'+idarray[i]).src = 'html/images/gstar-disable.png';

					}

			}

			

			

		    if(value == 'Y' && fieldname == 'chr_read')

			{

					for ( var i=0,len=idarray.length; i<len; ++i )

					{ 

						//classname= document.getElementById('gtr-'+idarray[i]).className;

						//classarray = classname.split('_');

						//finalclassname = classarray[0];

						document.getElementById('gtr-'+idarray[i]).className = 'grid-list-inner-table-text';

					}

			}

		   if(value == 'N' && fieldname == 'chr_read')

			{

					for ( var i=0, len=idarray.length; i<len; ++i ){

						//classname= document.getElementById('gtr-'+idarray[i]).className;

						//classarray = classname.split('_');

						//finalclassname = classarray[0]+'_b' ;

						document.getElementById('gtr-'+idarray[i]).className = 'grid-list-inner-table-text-active';

					}

			}

			

			document.getElementById(cmbid).value = '0';

		}

		else

		{

			alert("Sorry could not update...");

		}

		

		UnsetBackground();

		/*document.getElementById('dimmer').style.width=0;

		document.getElementById('dimmer').style.height=0;

		document.getElementById('dimmer').style.visibility="";

		document.getElementById('dvprocessing').style.display = 'none';*/

	}

	};

    xmlHttp.open("GET",url,true);

	xmlHttp.send(null);

}





/*-------------------------------Javascrit basic functions start here--------------------------------------------*/







//for left and right panels

function showHidePanels(id)

{

	var idstr1 = id+1;

	var idstr2 = id+2;

	

	if(document.getElementById(id).style.display == '')

	{

		

		document.getElementById(id).style.display = 'none';

		document.getElementById(idstr1).style.display = 'none';

		//document.getElementById(idstr2).style.display = 'none';

		

		

		document.getElementById(id).setAttribute('width', 0);

		document.getElementById(idstr1).setAttribute('width', 0);

		document.getElementById(idstr2).setAttribute('width', 5);

	}

	else

	{

		document.getElementById(id).style.display = '';

		document.getElementById(idstr1).style.display = '';

		document.getElementById(idstr2).style.display = '';

		

		document.getElementById(id).setAttribute('width', 204);

		document.getElementById(idstr1).setAttribute('width', 204);

		document.getElementById(idstr2).setAttribute('width', 5);

	}

}

// For tree-table

function expandCollapse(id)

{

	var cid = "collapse" + id;

	if(document.getElementById(id).style.display == "")

	{

		document.getElementById(id).style.display = "none";

		document.getElementById(cid).innerHTML = "+";

	}

	else

	{

		document.getElementById(id).style.display = "";

		document.getElementById(cid).innerHTML = "-";

	}

}





function expandcollapsepanel(panelid)

{



    if(document.getElementById(panelid).style.display == '')

    {

        document.getElementById(panelid).style.display = 'none';

    }

    else

    {

        document.getElementById(panelid).style.display = '';

    }



}

function KeycheckWithDecimal(e)

{

    var _dom = 0;

    _dom=document.all?3:(document.getElementById?1:(document.layers?2:0));

    if(document.all) e=window.event; // for IE

    var ch='';

    var KeyID = '';

    if(_dom==2){                     // for NN4

        if(e.which>0) ch='('+String.fromCharCode(e.which)+')';

        KeyID=e.which;

    }

    else

    {

        if(_dom==3){                   // for IE

            KeyID = (window.event) ? event.keyCode : e.which;

        }

        else {                       // for Mozilla

            if(e.charCode>0) ch='('+String.fromCharCode(e.charCode)+')';

            KeyID=e.charCode;

        }

    }

    if(KeyID == 46)

    {

        return true;

    }

    if((KeyID >= 65 && KeyID <= 90) || (KeyID >= 97 && KeyID <= 122) || (KeyID >= 33 && KeyID <= 47) || (KeyID >= 58 && KeyID <= 64) || (KeyID >= 91 && KeyID <= 96) || (KeyID >= 123 && KeyID <= 126))

    {

        return false;

    }

    return true;

}

function KeycheckOnlyNumeric(e)

{

	

   var _dom = 0;

    _dom=document.all?3:(document.getElementById?1:(document.layers?2:0));

    if(document.all) e=window.event; // for IE

    var ch='';

    var KeyID = '';

    if(_dom==2){                     // for NN4

        if(e.which>0) ch='('+String.fromCharCode(e.which)+')';

        KeyID=e.which;

    }

    else

    {

        if(_dom==3){                   // for IE

            KeyID = (window.event) ? event.keyCode : e.which;

        }

        else {                       // for Mozilla

            if(e.charCode>0) ch='('+String.fromCharCode(e.charCode)+')';

            KeyID=e.charCode;

        }

    }

    if((KeyID >= 65 && KeyID <= 90) || (KeyID >= 97 && KeyID <= 122) || (KeyID >= 33 && KeyID <= 47) || (KeyID >= 58 && KeyID <= 64) || (KeyID >= 91 && KeyID <= 96) || (KeyID >= 123 && KeyID <= 126))

    {

        return false;

    }

    return true;

}



function KeycheckOnlyNumeric_WithEnterKey(e,action)

{

    var enter_pressed = 0;//assume enter not pressed



   var _dom = 0;

    _dom=document.all?3:(document.getElementById?1:(document.layers?2:0));

    if(document.all) e=window.event; // for IE

    var ch='';

    var KeyID = '';

    if(_dom==2){                     // for NN4

        if(e.which>0) ch='('+String.fromCharCode(e.which)+')';

        KeyID=e.which;

    }

    else

    {

        if(_dom==3){                   // for IE

            KeyID = (window.event) ? event.keyCode : e.which;

            if(KeyID==13)

                {

                    enter_pressed = 1;

                }

        }

        else {                       // for Mozilla



            if(e.charCode>0) ch='('+String.fromCharCode(e.charCode)+')';

            KeyID=e.charCode;

             var key__for_mozilla =e.keyCode;

           // alert(key_try);



            if(key__for_mozilla==13)

                {

                    enter_pressed = 1;

                }

        }



    }

    if(enter_pressed == 1)

    {

        window[action]();

         return false;

    }

    else

    {

       if((KeyID >= 65 && KeyID <= 90) || (KeyID >= 97 && KeyID <= 122) || (KeyID >= 33 && KeyID <= 47) || (KeyID >= 58 && KeyID <= 64) || (KeyID >= 91 && KeyID <= 96) || (KeyID >= 123 && KeyID <= 126))

        {

            return false;

        }

        return true;

    }

}

function KeycheckOnlychar(e)

{

   var _dom = 0;

    _dom=document.all?3:(document.getElementById?1:(document.layers?2:0));

    if(document.all) e=window.event; // for IE

    var ch='';

    var KeyID = '';

    //alert(_dom);

    if(_dom==2){                     // for NN4

        //alert(e.which);

        if(e.which>0) ch='('+String.fromCharCode(e.which)+')';

        KeyID=e.which;

    }

    else

    {

        if(_dom==3){                   // for IE

            KeyID = (window.event) ? event.keyCode : e.which;

        }

        else {                       // for Mozilla

            //alert('Mozilla:' + e.charCode);

            if(e.charCode>0) ch='('+String.fromCharCode(e.charCode)+')';

            KeyID=e.charCode;

        }

    }



    if((KeyID > 47 && KeyID <58) )

    {

        //alert("hello");

        return false;

    }



    return true;

}



/******** Only Numeric **********/

function KeycheckOnlyPhonenumber(e)

{

   var _dom = 0;

	_dom=document.all?3:(document.getElementById?1:(document.layers?2:0));

	if(document.all) e=window.event; // for IE

	var ch='';

	var KeyID = '';

	//alert(_dom);

	if(_dom==2){                     // for NN4

		//alert(e.which);

		if(e.which>0) ch='('+String.fromCharCode(e.which)+')';

		KeyID=e.which;

	}

	else

	{

		if(_dom==3){                   // for IE

			KeyID = (window.event) ? event.keyCode : e.which;

		}

		else {                       // for Mozilla

			//alert('Mozilla:' + e.charCode);

			if(e.charCode>0) ch='('+String.fromCharCode(e.charCode)+')';

			KeyID=e.charCode;

		}

	}



	if((KeyID >= 65 && KeyID <= 90) || (KeyID >= 97 && KeyID <= 122) || (KeyID >= 33 && KeyID <= 39) || (KeyID >= 42 && KeyID <= 44) || (KeyID >= 46 && KeyID <= 47) || (KeyID >= 58 && KeyID <= 64) || (KeyID >= 91 && KeyID <= 96) || (KeyID >= 123 && KeyID <= 126))	

	{

		//alert("hello");

		return false;

	}

	

	return true;

}





function checkemail(str)

{

	var testresults;

	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i



	if (filter.test(str))

		testresults=true

	else

		testresults=false



	return (testresults)

}





function checkall(id)

{

	if(document.getElementById('chkall').checked == true)

	{

		var chkelements = document.getElementsByName(id);



		for(var i = 0; i < chkelements.length; i++)

		{

			chkelements.item(i).checked = true;

		}

	}

	else

	{

		var chkelements = document.getElementsByName(id);



		for(var i = 0; i < chkelements.length; i++)

		{

			chkelements.item(i).checked = false;

		}

	}

}





function onkeydown_search(evt)

{

	var key = (evt.which) ? evt.which : event.keyCode

	if(key==13)

	{

		 document.getElementById('search').focus();

	}

}

function onkeydown_go(evt)

{

	var key = (evt.which) ? evt.which : event.keyCode

	if(key==13)

	{  

		 document.getElementById('goto').focus();

	}

}



function trim(str, chars) {

return ltrim(rtrim(str, chars), chars);

}

function ltrim(str, chars) {

chars = chars || "\\s";

return str.replace(new RegExp("^[" + chars + "]+", "g"), "");

}

function rtrim(str, chars) {

chars = chars || "\\s";

return str.replace(new RegExp("[" + chars + "]+$", "g"), "");

}





function inquiryreplypopup(id)

{

    xmlHttp=GetXmlHttpObject()

	

    if(xmlHttp==null)

    {

        alert("Browser does not support HTTP Request")

        return

    }

	

   // var url="pageposition.php?module=settings&view=modules&eid="+id;

   

    var url="index.php?module=settings&view=modules&task=popup&ajax=Y&eid="+id;





    xmlHttp.onreadystatechange= stateChangeloginpopup

    xmlHttp.open("GET",url,true)

    xmlHttp.send(null)

}



function stateChangeloginpopup()

{

    SetBackground();



    if(xmlHttp.readyState==1)

    {

        ProcessLoader();

    }



    if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))

    {

        var popuph = 316;

        var popupw = 360;

        var popuph2 = popuph/2;

        var popupw2 = popupw/2;

        var winW = screen.width;

        var winH = screen.height;



        //alert(xmlHttp.responseText);



        if (parseInt(navigator.appVersion)>3) {



            if (navigator.appName=="Netscape") {

                winW = document.body.offsetWidth;

                winH = document.body.offsetHeight;

            }



            if (navigator.appName.indexOf("Microsoft")!=-1) {

                winW = document.body.clientWidth;

                winH = document.body.offsetHeight;

            }

        }



        var sh = winH;

        var sw = winW;

        var sh2 = sh/2;

        var sw2 = sw/2;

        var topf1 = sh2 - popuph;

        var leftf1 = sw2 - popupw2;



        document.getElementById('dvprocessing').style.display='none';

        document.getElementById('dvregisterfrm').style.display='';

        document.getElementById('dvregisterfrm').style.top=CalculateTop('211')+ "px";

        document.getElementById('dvregisterfrm').style.left=leftf1 + "px";

        document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;

		

    //unhideIframe();

    }

    

}

function positionedPopup(url,winName,w,h,t,l,scroll){

settings =

'height='+h+',width='+w+',top='+t+',left='+l+',scrollbars='+scroll+',resizable'

popupWindow = window.open(url,winName,settings)

}
