var gl_el; //global element

//function compares two dates (string format) date format = YYYY-MM-DD
/* @return: -1 value1 < value2
			 1 value1 > value2
			 0  value1 = value2
*/			
// trim() function defined to remove spaces
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function dateCompare (value1, value2) {
   var date1, date2;
   var month1, month2;
   var year1, year2;

   year1  = value1.substring (0, value1.indexOf ("-"));
   month1 = value1.substring(value1.indexOf ("-")+1, value1.lastIndexOf ("-"));
   date1  = value1.substring (value1.lastIndexOf ("-")+1, value1.length);

   year2  = value2.substring (0, value2.indexOf ("-"));
   month2 = value2.substring(value2.indexOf ("-")+1, value2.lastIndexOf ("-"));
   date2  = value2.substring (value2.lastIndexOf ("-")+1, value2.length);

   year1  = parseFloat(year1);
   month1 = parseFloat(month1);
   date1  = parseFloat(date1);

   year2  = parseFloat(year2);
   month2 = parseFloat(month2);
   date2  = parseFloat(date2);

   if (year1 > year2){ return 1;}
   else { 
		if (year1 < year2){  return -1;}
		else { //means year1=year2
			if (month1 > month2){ return 1;}
			else{ 
				if (month1 < month2) { return -1;}
				else {//means month1=month2
					if (date1 > date2){ return 1;}
					else { 
						if (date1 < date2) {  return -1;}
						else{ //means date1=date2
							return 0;
						}
					}
				}
			}
		}
   }
}
function counterText(field, countfield, maxlimit) {
	/*
	* The input parameters are: the field name;
	* field that holds the number of characters remaining;
	* the max. numb. of characters.
	*/
	if (field.value.length > maxlimit) // if the current length is more than allowed
		field.value =field.value.substring(0, maxlimit); // don't allow further input
	else
		countfield.value = maxlimit - field.value.length;
} // set the display field to remaining number



/*
	validation function
	
*/
function trim(st){
    if(st.length) {
        st = st.replace(/^\s+/, '');
        for (var i = st.length - 1; i >= 0; i--) {
            if (/\S/.test(st.charAt(i))) {
                st = st.substring(0, i + 1);
                break;
            }
        }
    }
    return st;
}

function isCharsInBag (s, bag)
  {
    var i;
    // Search through string's characters one by one.
    // If character is in bag, append to returnString.

    for (i = 0; i < s.length; i++)
    {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) return false;
    }
    return true;
 }

//function to check valid zip code
function isZIP(s) 
  {
    return isAlphaNumeric(s);
 }

//function to check valid Telephone,. Fax no. etc
function isPhone(s)
  {
	return isCharsInBag (s, "0123456789-+(). ");//simple test
	
	var PNum = new String(s);
	
	//	555-555-5555
	//	(555)555-5555
	//	(555) 555-5555
	//	555-5555

    // NOTE: COMBINE THE FOLLOWING FOUR LINES ONTO ONE LINE.
	var regex = /^[0-9]{3,3}\-[0-9]{3,3}\-[0-9]{4,4}$|^\([0-9]{3,3}\) [0-9]{3,3}\-[0-9]{4,4}$|^\([0-9]{3,3}\)[0-9]{3,3}\-[0-9]{4,4}$|^[0-9]{3,3}\-[0-9]{4,4}$/;
//	var regex = /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/; //(999) 999-9999 or (999)999-9999
	if( regex.test(PNum))
		return true;
	else
		return false;
	
	/*//code1
	var phone2 = /^(\+\d)*\s*(\(\d{3}\)\s*)*\d{3}(-{0,1}|\s{0,1})\d{2}(-{0,1}|\s{0,1})\d{2}$/; 
	if (s.match(phone2)) {
   		return true;
 	} else {
 		return false;
 	}

	
	*/
	
	/*//code2
	var stripped = s.replace(/[\(\)\.\-\ ]/g, '');
//strip out acceptable non-numeric characters
	if (isNaN(parseInt(stripped))) {
	   return false;
	}
	
	
	if (!(stripped.length == 10)) {
			return false;
	}
	*/
	
	/*//code3
	if (isCharsInBag (s, "- +().,/;0123456789") == false)
    {
        return false;
    }
    return true;
	*/
 }

function isAlphaNumeric(s,allowedCharacters) {
    bagOfCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    if(allowedCharacters) {
        bagOfCharacters= bagOfCharacters + allowedCharacters;
    }
    
    return isCharsInBag (s, bagOfCharacters);
}
function isNumeric(s,allowedCharacters) {
    bagOfCharacters = "0123456789.";
    if(allowedCharacters) {
        bagOfCharacters= bagOfCharacters + allowedCharacters;
    }
    return isCharsInBag (s, bagOfCharacters);
}
function isCharacters(s,allowedCharacters) {
    bagOfCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    if(allowedCharacters) {
        bagOfCharacters= bagOfCharacters + allowedCharacters;
    }
    return isCharsInBag (s, bagOfCharacters);
} 

function isEmpty(s)
{
		  s=trim(s);
		  return ((s == null) || (s.length == 0))
}

//function to check valid email id
function isEmail(s)
{
	 
	/*//code 3.
	var regex = /^([\w]+)(.[\w]+)*@([\w]+)(.[\w]{2,3}){1,2}$/;
    return regex.test(s);
	*/
	
	var regex = /(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i
	var regex =	/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    return regex.test(s);
	
}

function checkDomain(nname)
{
var arr = new Array(
'.com','.net','.org','.biz','.coop','.info','.museum','.name',
'.pro','.edu','.gov','.int','.mil','.ac','.ad','.ae','.af','.ag',
'.ai','.al','.am','.an','.ao','.aq','.ar','.as','.at','.au','.aw',
'.az','.ba','.bb','.bd','.be','.bf','.bg','.bh','.bi','.bj','.bm',
'.bn','.bo','.br','.bs','.bt','.bv','.bw','.by','.bz','.ca','.cc',
'.cd','.cf','.cg','.ch','.ci','.ck','.cl','.cm','.cn','.co','.cr',
'.cu','.cv','.cx','.cy','.cz','.de','.dj','.dk','.dm','.do','.dz',
'.ec','.ee','.eg','.eh','.er','.es','.et','.fi','.fj','.fk','.fm',
'.fo','.fr','.ga','.gd','.ge','.gf','.gg','.gh','.gi','.gl','.gm',
'.gn','.gp','.gq','.gr','.gs','.gt','.gu','.gv','.gy','.hk','.hm',
'.hn','.hr','.ht','.hu','.id','.ie','.il','.im','.in','.io','.iq',
'.ir','.is','.it','.je','.jm','.jo','.jp','.ke','.kg','.kh','.ki',
'.km','.kn','.kp','.kr','.kw','.ky','.kz','.la','.lb','.lc','.li',
'.lk','.lr','.ls','.lt','.lu','.lv','.ly','.ma','.mc','.md','.mg',
'.mh','.mk','.ml','.mm','.mn','.mo','.mp','.mq','.mr','.ms','.mt',
'.mu','.mv','.mw','.mx','.my','.mz','.na','.nc','.ne','.nf','.ng',
'.ni','.nl','.no','.np','.nr','.nu','.nz','.om','.pa','.pe','.pf',
'.pg','.ph','.pk','.pl','.pm','.pn','.pr','.ps','.pt','.pw','.py',
'.qa','.re','.ro','.rw','.ru','.sa','.sb','.sc','.sd','.se','.sg',
'.sh','.si','.sj','.sk','.sl','.sm','.sn','.so','.sr','.st','.sv',
'.sy','.sz','.tc','.td','.tf','.tg','.th','.tj','.tk','.tm','.tn',
'.to','.tp','.tr','.tt','.tv','.tw','.tz','.ua','.ug','.uk','.um',
'.us','.uy','.uz','.va','.vc','.ve','.vg','.vi','.vn','.vu','.ws',
'.wf','.ye','.yt','.yu','.za','.zm','.zw');

var mai = nname;
var val = true;

var dot = mai.lastIndexOf(".");
var dname = mai.substring(0,dot);
var ext = mai.substring(dot,mai.length);
//alert(ext);
    
if(dot>2 && dot<57)
{
    for(var i=0; i<arr.length; i++)
    {
      if(ext == arr[i])
      {
         val = true;
        break;
      }    
      else
      {
         val = false;
      }
    }
    if(val == false)
    {
         alert("Website extension "+ext+" is not correct");
         return false;
    }
    else
    {
        for(var j=0; j<dname.length; j++)
        {
          var dh = dname.charAt(j);
          var hh = dh.charCodeAt(0);
          if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || hh==45 || hh==46)
          {
             if((j==0 || j==dname.length-1) && hh == 45)    
               {
                    alert("Website name should not begin are end with '-'");
                  return false;
              }
          }
        else    {
               alert("Website name should not have special characters");
             return false;
          }
        }
    }
}
else
{
 alert("Website name is too short/long");
 return false;
}    

return true;
}

function OpenWin(width,height,URL,winName)
{
	winName = winName ? winName : '';
    window.open(URL,winName,"height=" + height + ",width=" + width + ",toolbar=no,location=no,directories=no,status=no,menubar=yes,,scrollbars=yes,resizable=yes");
}
//Validation for numeric fields
function isInteger(var1){
	str = var1;
	return isCharsInBag (str, "0123456789");
}

function isValidateUrl(strUrl) {
    var v = new RegExp();
    v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
    if (!v.test(strUrl)) { 
        return false;
    }
	return true;
} 
  // This function accepts a string variable and verifies if it is a
  // proper date or not. It validates format matching either
  // mm-dd-yyyy or mm/dd/yyyy. Then it checks to make sure the month
  // has the proper number of days, based on which month it is.	 
  // The function returns true if a valid date, false if not.
  // ******************************************************************	 
  function isDate(dateStr) 
  {

	   var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{2})$/;
	   var matchArray = dateStr.match(datePat); // is the format ok?
	   months= new Array(12);
	   months[0]="Jan";
	   months[1]="Feb";
	   months[2]="Mar";
	   months[3]="Apr";
	   months[4]="May";
	   months[5]="Jun";
	   months[6]="Jul";
	   months[7]="Aug";
	   months[8]="Sep";
	   months[9]="Oct";
	   months[10]="Nov";
	   months[11]="Dec"; 
	  if (matchArray == null) 
	  {
		  alert("Please enter date as either mm/dd/yy or mm-dd-yy.");
		  return false;
	  }
 
	  month = matchArray[1]; // parse date into variables
	  day = matchArray[3];
	  year = matchArray[5];

	  if (month < 1 || month > 12) // check month range
	  { 
		  alert("Month must be between 1 and 12.");
		  return false;
	  }
 
	  if (day < 1 || day > 31) 
	  {
		  alert("Day must be between 1 and 31.");
		  return false;
	  }
 
	  if ((month==4 || month==6 || month==9 || month==11) && day==31) 
	  {
		  alert("Month "+ months[month-1]+" doesn't have 31 days!")
		  return false;
	  }
 
	  if (month == 2)  // check for february 29th
	  {
		  var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		  if (day > 29 || (day==29 && !isleap)) 
		  {
			  alert("February " + year + " doesn't have " + day + " days!");
			  return false;
		  }
	  }
	  return true; // date is valid
  }


  function selval(sellist, selvalue){
  	for(iVar=0;iVar<sellist.options.length;iVar++){
		if (selvalue == ""){
			sellist.selectedIndex = 0;
			return;
		} else if (sellist.options[iVar].value == selvalue){
			sellist.selectedIndex = iVar;
			return;
		}
	}
	return;
  }
  //set focus on el or global variable gl_el;
  function setFocus(el){
	if(el != "undefined"){
		document.getElementById(el).focus();
		setAlertStyle(el);
	//	addEvent(document.getElementById(el),'onblur',function(){ alert('hello!'); })
	}else if(typeof gl_el != "undefined"){
		gl_el.focus();	
	}
	return true;
	
  }
  
  function setAlertStyle(el){
	document.getElementById(el).style.border = '2px solid';
	document.getElementById(el).style.borderColor = 'RED';
  }
  
  function unsetAlertStyle(el){
	//document.anchors[elm].removeProperty("color");  
	//document.getElementById(el).style.removeProperty("border");  
	//document.getElementById(el).style.removeProperty("borderColor");  
	document.getElementById(el).style.border = '1px solid';
	document.getElementById(el).style.borderColor = '';
  }

  function addEvent( obj, type, fn ) {
   if ( obj.attachEvent ) {
     obj['e'+type+fn] = fn;
     obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
     obj.attachEvent( 'on'+type, obj[type+fn] );
   } else
     obj.addEventListener( type, fn, false );
 }
 
 
 
/*
 * msg = message to print
 * callback = function to be called when ok is clicked
 * el is the element to be passed when cllback is called
 */
function winAlert(msg,el,callback){
	if(!callback)
		callback = 'setFocus';
	
	/*
	alert(el);
	eval(callback+'("'+el+'");');*/
	
	Dialog.alert(
		'<span class="arial14">'+msg+'</span>', 
		{
			windowParameters: 
			{
				className: "alphacube",
				width:300
			},
			
			okLabel: "OK",
			ok: function(win) { eval(callback+'("'+el+'");'); return true;}
		}
	);
	
}


/*
 * msg = message to print
 * callback = function to be called when ok is clicked
 * el is the element to be passed when cllback is called
 */
function winConfirm(msg,okcallback,cancelcallback){
	Dialog.confirm(
		msg,
		{
			windowParameters: 
			{
				className: "alphacube",
				width:300
			}, 
			
			okLable: "Ok",
			cancelLable: "Cancel",
			ok: function(win) { eval(okcallback); return true;},
			cancel:function(win) {
				if(cancelcallback){
					eval(cancelcallback);
				}
				return true;
			} 
		 }
	);	
}

function winOpen(url,width,height,name){
	if(!name)
		name = '';
	if(!width)
		width  = 800;
	if(!height)
		height = 500;
	leftVal = (screen.width - width) / 2;
	topVal = (screen.height - height) / 2;
	popUp = window.open(url,name,'menubar=1,scrollbars=1,resizable=1,width='+width+',height='+height+',left='+leftVal+',top='+topVal);
	return popUp;
}



function winClose(){
	window.close();
}

function intergerValue(value) {
	return parseInt(value);
}

function addOption(obj, val, txt) {
	var objOption = new Option(txt, val);
	obj.options.add(objOption);
}

function redirectURL(rediectUrl) {
	location.href= rediectUrl;
}

function removeHTMLTags(html){
	if(!isEmpty(html)){
		var strInputCode = html;
		/* 
			This line is optional, it replaces escaped brackets with real ones, 
			i.e. &lt; is replaced with < and &gt; is replaced with >
		*/	
		strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){
			return (p1 == "lt")? "<" : ">";
		});
		strTagStrippedText = strInputCode.replace(/(&nbsp;)/ig, "");
		return strTagStrippedText = strTagStrippedText.replace(/<\/?[^>]+(>|$)/g, "");
	}	
}
function showWaitMessage(msg) {
    
   /* if(document.getElementById('dialog_overlay_wait1')) {
        dvObj = document.getElementById('dialog_overlay_wait1');
    }
    else {
        dvObj = document.createElement('div');
        dvObj.id = 'dialog_overlay_wait1';
        document.body.insertBefore(dvObj, document.body.childNodes[0]);
    }
    dvObj.style.display='none';
    dvObj.innerHTML = '&nbsp;Processing...&nbsp;';
    //dvObj.innerHTML = '<img src="'+imagePathURL+'/loading.gif" border="0" />'
    dvWidth  = 100;
    dvHeight = 20;
    winH = document.body.clientHeight;
    winW = document.body.clientWidth;
    dvObj.style.top = ((winH - dvHeight)/2) +'px';
    dvObj.style.left = ((winW - dvWidth)/2)+'px';
    dvObj.style.zIndex = 10000;
    dvObj.style.border = '5px solid #c6c6c6';
    dvObj.style.width  = dvWidth;
    dvObj.style.height = dvHeight;
    dvObj.style.font   = 'normal normal 10pt verdana';
    dvObj.style.backgroundColor = '#DD6F00';
    dvObj.style.position = 'absolute';
    //dvObj.style.display = 'block';   */
    msg = msg ? msg : 'Processing...';
    displayStaticMessage(msg,false); 
}
function hideWaitMessage() {
       /* if(document.getElementById('dialog_overlay_wait1')) {
            document.getElementById('dialog_overlay_wait1').style.display = 'none';
        }  */
        closeMessage();
}
function messageBox(message) {
    //winAlert(message);
    //sm('box',500,300);
    alert(message);    
}
// url, page object which is created by calling initPage function, custom query string if any
function sendRequest(url, pageObj, queryString ) {
    // get all the form values
    if(pageObj.searchFormName) {
       params =pageObj.generateQueryString(pageObj.searchFormName);
    }
    else {
       params = '';
    }
    if(queryString) {
     // generate query string from all form fields
     params += '&'+queryString;
    }
    //initial query string
    if(pageObj.initialQueryString) {
        params += '&'+pageObj.initialQueryString;
    }
    
  //alert($(formName).serialize(true));
  //alert(params);
  //alert(url+'=='+pageObj);
  //asynchronous : false,
  new Ajax.Request(url, {
    method: 'post',
    parameters: params,
    onCreate: function() {
       showWaitMessage();
    },
    onSuccess: function(httpObj) {
         hideWaitMessage();
         responseData = trim(httpObj.responseText);
         //alert(responseData);
         j = responseData.evalJSON();
         
         if(j) {
         
         //assign page value to global variable
           pageObj.page = (j.page != 'undefined' && j.page!='') ? j.page : pageObj.page;
           //alert(j.page + '===' + pageObj.page);
           pageObj.sortField = (j.sortField != 'undefined' && j.sortField !='' ) ? j.sortField : pageObj.sortField;
           pageObj.sortOrderBy = (j.sortOrderBy != 'undefined' && j.sortOrderBy!='') ? j.sortOrderBy : pageObj.sortOrderBy;
           pageObj.totalRecords = (j.totalRecords!= 'undefined' && j.totalRecords!='') ? j.totalRecords : pageObj.totalRecords;
           //alert(j.page + '=jp===' + pageObj.page + '=lp===='+pageObj.sortField);

           // populate table with results
           if(document.getElementById(pageObj.divAddEdit)) {
            document.getElementById(pageObj.divAddEdit).style.display='none';
           }
           if(document.getElementById(pageObj.divResultName)) {
            document.getElementById(pageObj.divResultName).style.display='block';
           }
           //alert(pageObj.divResultName);
           // alert(pageObj.printResults(j.info, pageObj));
           document.getElementById(pageObj.divResultName).innerHTML=pageObj.printResults(j.info, pageObj);
                
         }
         else {
            messageBox(responseData);
         }
    }
  });
}
/** Pagination */
//url,recordsPerPage,linksPerPage,page,formName,sortField,sortOrderBy,divResult,divAddEdit,listTitle,pagingFlag,pageObjectName, table columns array
function initPage(url,recordsPerPage,linksPerPage,page,formName,sortField,sortOrderBy,divResult,divAddEdit,listTitle,pagingFlag,objName,colArray,editFunctionName,deleteFunctionName,initialQueryString) {
         this.URL = url; // ajax URL that will generate the list from the database
         this.recordsPerPage = recordsPerPage; // no of records that will be displayed in the list
         this.linksPerPage = linksPerPage; // no of links will be displayed in the pagination
         this.page = page; //default page no 
         this.searchFormName = formName; // search form name if search is required
         this.sortField = sortField; // default sort field
         this.sortOrderBy = sortOrderBy; // default sort order ASC/DESC
         this.divResultName = divResult; // results div, that will contain the ajax results
         this.divAddEdit = divAddEdit; // div for add/edit records in the list
         this.listTitle = listTitle; // title of the list
         this.paging = pagingFlag; // for pagination true/false, if true, paging will be displayed
         this.totalRecords = 0; // initialize total records;
         this.objName = objName; // this is name of initPage's object
         this.tableColumnsArray = colArray; // table columns (Sr No, Name etc)
         this.editFunctionName    = (editFunctionName)? editFunctionName : 'abcd';  //abcd fake name
         this.deleteFunctionName  = (deleteFunctionName)? deleteFunctionName : 'abcd';  //abcd fake name
         this.initialQueryString = initialQueryString ? initialQueryString : ''; // if query string is required 
}
initPage.prototype.pagination = function() {

           printLink=''; //initialize the links
           totalPages = Math.ceil(parseFloat(this.totalRecords)/parseFloat(this.recordsPerPage));
           if(parseFloat(this.page)>parseFloat(totalPages)) {
              this.page = totalPages;
           }
           
           //show paging links when total records are more than records per page
           if(parseFloat(this.totalRecords) > parseFloat(this.recordsPerPage) ) {

                  printLink = '<span class="pagingFont"><b>Pages:</b> '+totalPages+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
                  if(parseFloat(this.page)>1) {

                   printLink += ' <a href="#" onClick="sendRequest(\''+this.URL+'\','+this.objName+',\'page=1&sortOrderBy='+this.sortOrderBy+'&sortField='+this.sortField+'\');return false;" class="paging"><img src="'+imagePath+'/first.gif" border="0" title="First" align="absmiddle" /></a>&nbsp;&nbsp;';

                    printLink += ' <a onClick="sendRequest(\''+this.URL+'\','+this.objName+',\'page='+(parseInt(this.page)-1)+'&sortOrderBy='+this.sortOrderBy+'&sortField='+this.sortField+'\');return false;" href="#" class="paging"><img src="'+imagePath+'/back.gif" border="0"  title="Previous" align="absmiddle" /></a>&nbsp;&nbsp;';
                  }

                   half = Math.floor(parseFloat(this.linksPerPage)/2);
                   if(this.page>half) {
                     start = this.page - half;
                     limit = parseFloat(this.page) + parseFloat(half);
                     if(limit > totalPages)
                         limit = totalPages;
                   }
                   else {
                     start = 1;
                     limit = this.linksPerPage;
                     if(limit>totalPages)
                         limit = totalPages;
                   }
                   // alert(limit + '==' +start);

                    for(link=start;link<=parseFloat(limit);link++) {
                         if(link==this.page) {
                             printLink += ' <b>'+link+'</b>';
                         }
                         else {
                              printLink +=' <a onClick="sendRequest(\''+this.URL+'\', '+this.objName+',\'page='+link+'&sortOrderBy='+this.sortOrderBy+'&sortField='+this.sortField+'\' );return false;" class="paging" href="#"><u>'+link+'</u></a> ';
                         }
                    }

                   if(parseFloat(this.totalRecords)>( parseFloat(this.page)*parseFloat(this.recordsPerPage) )) {
                      printLink += '&nbsp;&nbsp;<a href="#" onClick="sendRequest(\''+this.URL+'\','+this.objName+', \'page='+(parseInt(this.page)+1)+'&sortOrderBy='+this.sortOrderBy+'&sortField='+this.sortField+'\' );return false;" class="paging"><img src="'+imagePath+'/next.gif" border="0" title="Next" align="absmiddle" /></a>&nbsp;';
                      printLink +=  ' <a onClick="sendRequest(\''+this.URL+'\', '+this.objName+', \'page='+totalPages+'&sortOrderBy='+this.sortOrderBy+'&sortField='+this.sortField+'\' );return false;" href="#" class="paging"><img src="'+imagePath+'/last.gif" border="0"  title="Last" align="absmiddle" /></a>';
                    }

                    printLink +='</span>';

           }
           //alert(printLink);
           return printLink;
}
//paging true or false
initPage.prototype.printResults = function(resultArray, pageObj){
            tb ='';
            tb ='<table border="0" cellpadding="0" cellspacing="0" width="100%" class="border1" align="center">';
            tb +='<tr><td class="listTitle">'+pageObj.listTitle+'</td></tr><tr><td>';
            tb += '<table border="0" cellpadding="0" cellspacing="1" width="100%" align="center" class="border2">';
            //for head labels
            headLength = this.tableColumnsArray.length;
            if( (headLength && !resultArray.length && this.totalRecords>0) || (headLength && resultArray.length) ){
                tb += '<tr>';
                for(i=0;i<headLength;i++) {

                  // alert(this.tableColumnsArray[i][4]);
                  if(this.tableColumnsArray[i][3]!='undefined' && this.tableColumnsArray[i][3]===true) {
                        if( this.tableColumnsArray[i][0] == this.sortField) {

                            if(this.sortOrderBy == 'ASC') {
                                showSortBox = '<img onClick="sendRequest('+this.objName+'.URL,'+this.objName+',\'page='+pageObj.page+'&sortField='+pageObj.sortField+'&sortOrderBy=DESC\');return false;" src="'+imagePath+'/arrow-up.gif" border="0"/>';
                            }
                            else {
                                showSortBox = '<img onClick="sendRequest('+this.objName+'.URL,'+this.objName+',\'page='+pageObj.page+'&sortField='+pageObj.sortField+'&sortOrderBy=ASC\');return false;" src="'+imagePath+'/arrow-down.gif" border="0"/>';
                            }
                        }
                        else {
                             showSortBox = '<img onClick="sendRequest('+this.objName+'.URL,'+this.objName+',\'page=1&sortField='+this.tableColumnsArray[i][0]+'&sortOrderBy=ASC\');return false;" src="'+imagePath+'/arrow-none.gif" border="0"/>';
                        }
                        //sortTableField
                  }
                  else {
                      showSortBox = '';
                  }

                   columnAttributes = this.tableColumnsArray[i][2]!='undefined' ? this.tableColumnsArray[i][2] : '';
                   tb += '<td class="rowHeading1" '+columnAttributes+'>'+this.tableColumnsArray[i][1]+'&nbsp;'+showSortBox+'</td>';
                   }
                tb += '</tr>';

                    len = resultArray.length;
                    if(len!='undefined' && len>0) {
                            //for values
                            for(i=0;i<len;i++) {
                                var bg = bg=='class="rowBg1"' ? 'class="rowBg2"' : 'class="rowBg1"';
                                
                                tb +='<tr '+bg+' onClick="changeRowColor(this)">';
                                 for(h=0;h<headLength;h++) {
                                      aln = this.tableColumnsArray[h][2]!='undefined' ? this.tableColumnsArray[h][2] : '';
                                      if(this.tableColumnsArray[h][0]=='action') {
                                              tb +='<td class="paddingNormal" '+aln+'><a href="#" title="Edit"><img src="'+imagePath+'/bt_edit.gif" border="0" alt="Edit" onclick="'+this.editFunctionName+'('+(eval('resultArray['+i+'].'+this.tableColumnsArray[h][0]))+',\''+this.divAddEdit+'\');return false;"/></a>&nbsp;&nbsp;<a href="#" title="Delete"><img src="'+imagePath+'/bt_delete.gif" border="0" alt="Delete" onClick="return '+this.deleteFunctionName+'('+(eval('resultArray['+i+'].'+this.tableColumnsArray[h][0]))+');return false;"/></a></td>';
                                      }
                                      else {
                                              tb +='<td class="paddingNormal" '+aln+'>'+eval('resultArray['+i+'].'+this.tableColumnsArray[h][0])+'&nbsp;</td>';
                                      }
                                  }
                              tb +='</tr>';
                            }
                    }
                    else {
                        tb +='<tr><td colspan="'+headLength+'" align="center">no detail found</td></tr>';
                        // in case user deletes all the records on some page say page=7, then redirect to previous page
                        if(parseInt(this.page)>1 && parseInt(this.totalRecords) >0) {
                            sendRequest(this.URL,pageObj,'page='+(parseInt(this.page)-1)+'&sortOrderBy='+this.sortOrderBy+'&sortField='+this.sortField);
                        }
                }
                if(this.paging) {
                   var pageLinks = this.pagination();
                   if(pageLinks!='') {
                       //tb +='<tr><td class="padding_top" colspan="'+headLength+'">&nbsp;</td></tr>';
                       tb +='<tr><td colspan="'+headLength+'" align="right">'+pageLinks+'&nbsp;</td></tr>';
                   }
                }
            }
            else {
                tb +='<tr><td align="center">no detail found</td></tr>';            
            }
            tb +='</table>';
            tb +='</td></tr></table>';
            //alert('pushpender==='+tb);
            return tb;

}
initPage.prototype.generateQueryString = function(frmName) {

  frmObj = document.forms[frmName].elements;
  len = frmObj.length;
  queryString = '';
  for(i=0;i<len;i++) {
      if(frmObj[i].checked == true && (frmObj[i].type =='radio' || frmObj[i].type =='checkbox')) {
            if(queryString!='') {
                queryString +='&';
            }
        queryString +=frmObj[i].name + '=' + frmObj[i].value;
      }
      else if (frmObj[i].type !='radio' && frmObj[i].type !='checkbox') {
            if(frmObj[i].type == 'select-multiple') {
                eleName = frmObj[i].name;
                eleLength = frmObj[eleName].length;
                selectedEle='';
                for(m=0;m<eleLength;m++) {
                    if (frmObj[i][m].selected == true) {
                        if (selectedEle != '') {
                            selectedEle += '&';
                        }
                        selectedEle += eleName+'='+frmObj[i][m].value;
                    }
                }
                if(queryString!='') {
                    queryString +='&';
                }
                queryString += selectedEle;
            }
            else {
                if(queryString!='') {
                    queryString +='&';
                }         
                // replace invalid characters
                nm = frmObj[i].value.replace('&','\\&');
                nm = escape(nm);   
                queryString +=frmObj[i].name + '=' + nm;
            }
      }
  }
  return queryString;  
  
}
function changeRowColor(obj) {
    if(obj.style.backgroundColor != '') {
        obj.style.backgroundColor='';          
    }
    else {
        obj.style.backgroundColor='#FFCC99';    
    }
}
// this function will accept divname that is to be hidden and the dive that is to be displayed
function displayDiv(hideDivId,showDivId,focusDivId,callBackFunction) {
    //$(hideDivId).fade();
    //Effect.Puff(hideDivId); 
    //Effect.Shrink(hideDivId);
    
    //Effect.SwitchOff(hideDivId);
    //Effect.Grow(showDivId);
    //Effect.SlideDown(showDivId);
    //displayStaticMessage(showDivId,false);
    //$(showDivId).show(); 
    if(document.getElementById(hideDivId)) {
        document.getElementById(hideDivId).style.display='none';
    }
    if(document.getElementById(showDivId)) {
        document.getElementById(showDivId).style.display='block';
    }
    if(focusDivId && !document.getElementById(focusDivId).disabled) {
      document.getElementById(focusDivId).focus();      
    }
    if(callBackFunction) {
        eval(callBackFunction);
    } 
}

function showDiv(dv) {
    if(document.getElementById(dv)) {
        document.getElementById(dv).style.display='block';
    }
}
function hideDiv(dv) {
    if(document.getElementById(dv)) {
        document.getElementById(dv).style.display='none';
    }
}
function emptyFormValues(frmName) {      
    if(document.getElementById(frmName)) {
        document.getElementById(frmName).reset();
    }
}
/********modal Dialog ******start**/
DHTML_modalMessage = function()
{
    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 = 'css.css';    // Default CSS file
    this.height = 200;                        // Default height of modal message
    this.width = 400;                        // 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;
    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)
    {
        this.url = urlOfSource;
        
    }    
    // }}}    
    ,
    // {{{ 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(divName)
    {
        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(divName);    // Calling method which inserts content into the message div.
    }
    // }}}        
    ,
    // {{{ ()
    /**
     *    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.
        
        /* 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    
     */        
    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('<IFRAME src="about:blank" frameborder=0>');
            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];
        
        // Setting width and height of content div
          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';
        
         if(this.MSIE){
             this.iframe.style.left = this.divs_content.style.left;
             this.iframe.style.top = this.divs_content.style.top;
             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.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(divName)
    {
        if(this.url){    // url specified - load content dynamically
            ajax_loadContent('DHTMLSuite_modalBox_contentDiv',this.url);
        }else{    // no url set, put static content inside the message box
            
            if(document.getElementById(divName)) {
               this.divs_content.innerHTML = document.getElementById(divName).innerHTML;  
            }
            else {
                this.divs_content.innerHTML = this.htmlOfModalMessage;
            }
        }
    }        
}
function displayStaticMessage(divId,cssClass) {
    messageObj.setHtmlContent(divId);
    messageObj.setSize(100,20);
    messageObj.setCssClassMessageBox(cssClass);
    messageObj.setSource(false);    // no html source since we want to use a static message here.
    messageObj.setShadowDivVisible(false);    // Disable shadow for these boxes    
    messageObj.display(divId);
}
function closeMessage() {
    messageObj.close();    
}
/********modal Dialog ******end**/
/***** NA on registration pages*******start****/
function commonSetValues(obj,copyTo) {
    document.getElementById(copyTo).value = '';
    if(obj) {
        if(obj.checked) {
            if(document.getElementById(copyTo)) {
                eval("document.naForm."+copyTo+".value=1;");
               //document.getElementById(copyTo).value = 1;
               //alert(document.getElementById(copyTo).value);
            }
        }
        else {
            if(document.getElementById(copyTo)) {
                eval("document.naForm."+copyTo+".value=0;");
                //document.getElementById(copyTo).value = 0;
                //alert(document.getElementById(copyTo).value); 
            }            
        }
    }    
}
/***** NA on registration pages*******end**/
/************/
function checkAll(obj) {
    if(obj) {
        len = obj.length
        if(len && len>0) {
            for(i=0;i<len;i++) {
                obj[i].checked = true;
            }
        }
        else {
            if(obj) {
                obj.checked= true;
            }
        }
    }   
}
function unCheckAll(obj) {
    if(obj) {
        len = obj.length
        if(len && len>0) {
            for(i=0;i<len;i++) {
                obj[i].checked = false;
            }
        }
        else {
            if(obj) {
                obj.checked= false;
            }
        }
    }
}
// return true/false if checked/unchecked
function isChecked(obj) {
    if(obj) {
        len = obj.length
        ret = false;
        if(len && len>0) {
            for(i=0;i<len;i++) {
                if(obj[i].checked) {
                  return true;
                  break;
                }
            }
        }
        else {
            if(obj) {
                if(obj.checked) {
                    return true;
                }
            }
        }
        return ret;
    }
    else {
        return false;
    }
}
function selAll(obj) {
    if(obj) {
        len = obj.length
        if(len && len>0) {
            for(i=0;i<len;i++) {
                obj[i].selected = true;
            }
        }
        else {
            if(obj) {
                obj.selected= true;
            }
        }
    }   
}
function unSelAll(obj) {
    if(obj) {
        len = obj.length
        if(len && len>0) {
            for(i=0;i<len;i++) {
                obj[i].selected = false;
            }
        }
        else {
            if(obj) {
                obj.selected= false;
            }
        }
    }
}
function showDiv(dv) {
    document.getElementById(dv).style.display='block';    
}
function hideDiv(dv) {
    document.getElementById(dv).style.display='none';    
}
// to adjust footer position
function adjustFooter(dv) {
    bodyHeight = document.documentElement.clientHeight;
    bodyHeight = bodyHeight ? bodyHeight : document.body.clientHeight;
    //alert(bodyHeight);
    ypos =findPosY(document.getElementById(dv));
    bodyHeight = bodyHeight - 50; // to reduce the height;
    //alert(ypos);
    if(bodyHeight>ypos) {        
        setPos = bodyHeight - ypos;
        if(parseFloat(ypos)<500) {
            document.getElementById(dv).style.height = setPos+'px';
        }
    }
}
// find the current X position of an element
function findPosX(obj) {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
}
// find the current Y position of an element
function findPosY(obj) {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
}
function divClose(dv) {
//st = 'document.getElementById(\''+dv+'\').style.display=\'\';';
return '<div style="background:#389BB7;cursor:pointer;display:inline;color:#ff0000;font-weight:bold;width:100%" onclick="Spry.Effect.DoFade(\''+dv+'\', {duration: 1000, from:100, to:0, toggle: true});'+st+'" >Close</div>';
}

//return index no if no option selected from DDM array
function retIndexOnEmpty(obj) {
    ret = -1;
    if(obj) {
        len = obj.length
        if(len && len>0) {
            for(i=0;i<len;i++) {
                if(isEmpty(obj[i].value)) {
                    ret = i;
                    //alert(ret);
                    break;
                }
            }
        }
        else { //alert('fdfdd');
            if(obj) {
                if(isEmpty(obj.value)) {
                    ret = 0;                
                }
            }
        }
    }
    return ret;   
}
//populate default value in array's values
function popDefValue(fromObj,toArrObj) {
    if(toArrObj) {
        len = toArrObj.length
        if(len && len>0) {
            for(i=0;i<len;i++) {
                toArrObj[i].value = fromObj.value;
            }
        }
        else { //alert('fdfdd');
            if(toArrObj) {
               toArrObj.value = fromObj.value;
            }
        }
    } 
}
function popResultInDiv(dv,url,qtr) {
    if(document.getElementById(dv)!=null) {
     // document.getElementById(dv).style.display='';
    new Ajax.Request(url,
           {
             method:'post',
             parameters: qtr,
             onCreate: function() {
                showWaitMessage();
             },
             onSuccess: function(transport){
                hideWaitMessage();
                document.getElementById(dv).innerHTML = trim(transport.responseText);
             },
             onFailure: function(){ messageBox("<?php echo TECHNICAL_PROBLEM;?>") }
           });
    }
}
// setTimeout(\'Spry.Effect.DoBlind(\''+dv+'\', {duration: 1000, from:  \'100%\', to: \'0%\', toggle: true})\',1000);
/**********/