function ttlightbox(strURL,divName) {

    var xmlHttpReq = false;



    var self = this;



    document.getElementById(divName).innerHTML="<img align=top src='manager/images/ajax3.gif' title='Update in progress...'>";



	

	if(self.xmlHttpReq)

	self.xmlHttpReq.abort();

	

	

	if (window.XMLHttpRequest)

        self.xmlHttpReq = new XMLHttpRequest();

    else if (window.ActiveXObject) 

       self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");

	

	self.xmlHttpReq.open('POST', strURL, true);



    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');



    self.xmlHttpReq.onreadystatechange = function() {



        if (self.xmlHttpReq.readyState == 4) 

		{

				document.getElementById(divName).innerHTML=self.xmlHttpReq.responseText;



// lightbox ready again =---------------------------------				

$(document).ready(function () {

	$('.contactForm ').click(function (e) {

		e.preventDefault();

		

		// load the contact form using ajax

		$.get(tt, function(data){

			// create a modal dialog with the data

			$(data).modal({

				close: false,

				overlayId: 'contact-overlay',

				containerId: 'contact-container',

				onOpen: contact.open,

				onShow: contact.show,

				onClose: contact.close

			});

		});

	});



	// preload images

	var img = ['cancel.png','form_bottom.gif','form_top.gif','form_top_ie.gif','loading.gif','send.png'];

	$(img).each(function () {

		var i = new Image();

		i.src = 'img/contact/' + this;

	});

});

				

				

///---------------------------------// lightbox ready again =---------------------------------				

				

				

				

    	}

	}	



    self.xmlHttpReq.send('');

	

	

}





function chkBrowser()

{

  return navigator.appName;

} 

 

 function makeDoc(id,type) {

	

	mypara=document.getElementById(id);

	if(document.getElementById("dnfrm")){

	myrform=document.getElementById("dnfrm");

	mypara.removeChild(myrform);

	}

	myform1tt=document.createElement("form");

	myform1tt.setAttribute("name","dnfrm");

	myform1tt.setAttribute("id","dnfrm");	

	myform1tt.setAttribute("method","post");

	myform1tt.setAttribute("action","");

	

	myele=document.createElement("input");

	myele.setAttribute("type","hidden");

	myele.setAttribute("name","dyncnt");

	myele.setAttribute("id","dyncnt");

	myele.setAttribute("value",document.getElementById(id).innerHTML);

	

	myele1=document.createElement("input");

	myele1.setAttribute("type","hidden");

	myele1.setAttribute("name","dyntype");

	myele1.setAttribute("id","dyntype");

	myele1.setAttribute("value",type);

	

	myform1tt.appendChild(myele);

	myform1tt.appendChild(myele1);

	mypara.appendChild(myform1tt);

    myform1tt.submit();

	if(document.getElementById("divIdName")) document.getElementById("divIdName").style.display='none';	

    }

	

function CallPrint(id)

{

var prtContent = document.getElementById(id).innerHTML;

var WinPrint =window.open('','','left=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');

WinPrint.document.open();

WinPrint.document.write(prtContent);

WinPrint.document.close();

WinPrint.focus();

WinPrint.print();

WinPrint.close();

if(document.getElementById("divIdName")) document.getElementById("divIdName").style.display='none';	

//prtContent.innerHTML=strOldOne;

}



function changeTime(obj,e)

{

	var keynum

	var keychar

	var numcheck



	if(window.event) // IE

	{

		keynum = e.keyCode

	}

	else if(e.which) // Netscape/Firefox/Opera

	{

		keynum = e.which

	}

	//keychar = String.fromCharCode(keynum)

	if (obj.value.match(/(0[1-9]|1[0-2]):(0[0-9]|[1-5][0-9]) (AM|PM)/im)) 

	{

		str=obj.value.replace(" ",":").split(":");

		sel_start=obj.selectionStart;

		sel_end=obj.selectionEnd;

		

		if (keynum==38) 

		{

			if (obj.selectionStart<=2) 

			{

				sel_start=0;

				sel_end=2;

				n=parseInt(str[0],10);

				str[0]='0'+(n+1>12?1:n+1).toString();

				str[0]=str[0].substring(str[0].length-2,str[0].length)

			}

			else if (obj.selectionStart<=5)

			{

				sel_start=3;

				sel_end=5;

				n=parseInt(str[1],10);

				str[1]='0'+(n+10>50?0:n+10).toString();

				str[1]=str[1].substring(str[1].length-2,str[1].length)

			}

			else

			{

				sel_start=6;

				sel_end=8;

				str[2]=str[2]=='am'?'pm':'am';

			}

			

		}

		else if (keynum==40) 

		{

			if (obj.selectionStart<=2) 

			{

				sel_start=0;

				sel_end=2;

				n=parseInt(str[0],10);

				str[0]='0'+(n-1<1?12:n-1).toString();

				str[0]=str[0].substring(str[0].length-2,str[0].length)

			}

			else if (obj.selectionStart<=5)

			{

				sel_start=3;

				sel_end=5;

				n=parseInt(str[1],10);

				str[1]='0'+(n-10<0?50:n-10).toString();

				str[1]=str[1].substring(str[1].length-2,str[1].length)

			}

			else

			{

				sel_start=6;

				sel_end=8;

				str[2]=str[2]=='am'?'pm':'am';

			}

		}

		

		obj.value=str[0].toString()+':'+str[1].toString()+' '+str[2].toString();

		obj.selectionStart=sel_start;

		obj.selectionEnd=sel_end;

	} 

	else 

	{

		obj.value="12:00 am";

	}

}





function addItemRow1(flag,ids,names,ans)

{



  var tbl = document.getElementById('tblAns');

  var lastRow = tbl.rows.length;

  var iteration = lastRow;

  var row = tbl.insertRow(lastRow);

 // alert(lastRow);

  //id=ids.toString().replace(/,/g,"_")

  

  id=lastRow;

  row.setAttribute("name","div_"+id);

  row.setAttribute("id","div_"+id);

 

  class1="noborder";

  class2="text10"; 

   

  var cellItemName= row.insertCell(0);

  cellItemName.setAttribute("align","left");

  cellItemName.setAttribute("height", "25");

  cellItemName.setAttribute("width","135");

 

 var el = document.createElement('input');

  el.setAttribute('type', 'checkbox');

  el.setAttribute('name', 'listing_id[]');

  el.setAttribute('id', 'listing_id[]');

  cellItemName.appendChild(el);

 

  

 



  var cellItemCost= row.insertCell(1);

  cellItemCost.setAttribute("width","135");

  var el = document.createElement('input');

  el.setAttribute('type', 'text');

  el.setAttribute('name', 'ans[]');

  el.setAttribute('id', 'ans[]');

  el.setAttribute('value',ans);

  el.setAttribute('size','55');

  el.setAttribute('class',class2);

  el.setAttribute('className', class2);

  cellItemCost.appendChild(el);

  

 

  

  

   //	var cellItemName= row.insertCell(3);

  //	cellItemName.setAttribute("align","right");

  //	cellItemName.setAttribute("height", "25");

  //	var el = document.createElement('img');

	//el.setAttribute('src', "images/edit.gif");

	//cellItemName.appendChild(el);

 

  

  



}





function addItemRow(flag,ids,names,ans,answ)

{



  var tbl = document.getElementById('tblAns');

  var lastRow = tbl.rows.length;

  var iteration = lastRow;

  var row = tbl.insertRow(lastRow);

 // alert(lastRow);

  //id=ids.toString().replace(/,/g,"_")

  

  id=lastRow;

  row.setAttribute("name","div_"+id);

  row.setAttribute("id","div_"+id);

 

  class1="noborder";

  class2="text10"; 

   

  var cellItemName= row.insertCell(0);

  cellItemName.setAttribute("align","left");

  cellItemName.setAttribute("height", "25");

  cellItemName.setAttribute("width","135");

 

 var el = document.createElement('input');

  el.setAttribute('type', 'checkbox');

  el.setAttribute('name', 'listing_id[]');

  el.setAttribute('id', 'listing_id[]');

  cellItemName.appendChild(el);

 

  

 



  var cellItemCost= row.insertCell(1);

  cellItemCost.setAttribute("width","135");

  var el = document.createElement('input');

  el.setAttribute('type', 'text');

  el.setAttribute('name', 'ans[]');

  el.setAttribute('id', 'ans[]');

  el.setAttribute('value',ans);

  el.setAttribute('size','55');

  el.setAttribute('class',class2);

  el.setAttribute('className', class2);

  cellItemCost.appendChild(el);

  

   var cellItemName= row.insertCell(2);

//  var cellItemCost= row.insertCell(1);

  cellItemCost.setAttribute("width","55");

  var e2 = document.createElement('input');

  e2.setAttribute('type', 'text');

  e2.setAttribute('name', 'answ[]');

  e2.setAttribute('id', 'answ[]');

  e2.setAttribute('value',answ);

  e2.setAttribute('size','10');

  e2.setAttribute('class',class2);

  e2.setAttribute('className', class2);

  cellItemName.appendChild(e2);

  

  

   	var cellItemName= row.insertCell(3);

  	cellItemName.setAttribute("align","right");

  	cellItemName.setAttribute("height", "25");

  //	var el = document.createElement('img');

	//el.setAttribute('src', "images/edit.gif");

	//cellItemName.appendChild(el);

 

  

  



}





function removeRow()

{

  var tbl = document.getElementById('tblAns');

  var lastRow = tbl.rows.length;

  var iteration = lastRow;

  tbl.deleteRow(tbl.rows.length-1);

 /* for (i=3;i<iteration;i++)

  {

  	tbl.deleteRow(tbl.rows.length-1);

	

  }*/



}







function search_enter(e) {

	

      if (e.keyCode) 

	  keycode=e.keyCode;

      else keycode=e.which;

      

	  

	  var sPath = window.location.pathname;

	  var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

	  var pass;

	  pass=0;

		if(sPage=="assign_category.php" || sPage=="relatedarticle.php")

		pass=1;

	  

	  

				if((keycode==13)&& (pass==1))

			   {

				

				var el = document.createElement('input');

				  el.setAttribute('type', 'text');

				  el.setAttribute('name', 'Submit');

				  el.setAttribute('id', 'Submit');

				  el.setAttribute('value','Search');	

				  document.getElementById("Form1").appendChild(el);

			

			   document.getElementById("Form1").submit();

			   }

	  

   }







function showInfo(heading,txt)

{

	document.getElementById("errorBoxHeading").innerHTML=heading;

	document.getElementById("errorBoxText").innerHTML=txt;

	document.getElementById("errorBox").style.left=(mouseX-200)+"px";

	document.getElementById("errorBox").style.top=(mouseY-100)+"px";

	document.getElementById("errorBox").style.display='block';

	return false;

}	



	function actRecord(frm,button) 

	{

	

	if (button.value=="Change Status")

	{

	

	frm.set_step.value="Change";

	}

	if (button.value=="Delete Selected")

	{

	

	frm.set_step.value="Remove";				

	}		

			

	frm.submit();

	

	}

function selectListings(frm,obj)

	{

		//alert(frm+"============"+obj);

		var i=0;

		var flag=false;

		if (frm.listing_id.length==null)

		{

			frm.listing_id.checked=obj.checked;

			flag=true;

		}

		else

		{

			

			for (i=0;i<frm.listing_id.length;i++)

			{

				frm.listing_id[i].checked=obj.checked;

				flag=true;

			}

			

		}

	}



function drawTable(maxlength, tablewidth, tablename)

{

	if ((navigator.appName.indexOf("Microsoft") !=-1) && (parseInt(navigator.appVersion)>= 4))

	{

		var str;

	    str='<table id="box" name="'+maxlength+'" cellpadding="0" cellspacing="0" border="0" width="'+tablewidth+'">';

	    str += '<tr>';

	    str += '<td bgcolor="#003366" width="0"><img src="/images/dot.gif" name="'+tablename+'1" height="5" width="0"></td>';

	    str += '<td bgcolor="#8CAAE6" width="'+tablewidth+'"><img src="/images/dot.gif" name="'+tablename+'2" height="5" width="'+tablewidth+'"></td></tr>';

	    //str += '<tr><td colspan="2"><div><span name=tablename3 style="width:'+tablewidth/2+'px;"></span><span id="'+tablename+'4" style="width:'+tablewidth/2+'px;text-align:right;"></span></div></td></tr>';

	    str += '</table>';

		document.write(str);

	}

	else 

	{

	    document.write(' ');

	}

}



function funMycomment(a){

	obj=document.getElementById('box');

	tblwidth=obj.width;

	maxlen=obj.name;

	var aa

	aa=document.getElementById(a.id);

	x = maxlen - aa.value.length;

	if (x <0)

	{

	    aa.value=aa.value.substring(0,maxlen);

	    x=0;

	    alert('Maximum '+maxlen+' character used');

	}

	

	eval("document."+a.id+"1").width=tblwidth*(maxlen-x)/maxlen;

	eval("document."+a.id+"1").alt=maxlen-x+" chars used";

	eval("document."+a.id+"2").width=tblwidth*x/maxlen;

	eval("document."+a.id+"2").alt=x+" chars available";

	//document.getElementByName("tablename3").innerHTML=maxlen-x+" chars used";

	//document.getElementById("tablename4").innerHTML=x+" chars left";

}



///////////////////////

		

function isdefined( variable)

{

    return (typeof(window[variable]) == "undefined")?  false: true;

}





function validateForm(frm) {

	

	

//alert(frm);

	for (cnt=0; cnt < frm.elements.length; cnt++) {

		

		req = frm.elements[cnt].lang;

//		alert(req);

		if (req != "" && req != null && req != "0") {

		ctl = frm.elements[cnt];

		

		//value = trim(frm.elements[cnt].value);

		value = trim(frm.elements[cnt].value);

//		alert(value);

		type = frm.elements[cnt].type.toUpperCase();

		title = frm.elements[cnt].title;

//		alert(type);

			

			req = req.toUpperCase();

			

			//textbox

			if (type == "TEXT" || type == "TEXTAREA") {

				

				//Simple blank value check											[MUST]

				if (req.indexOf("MUST") != -1) {

					if (value == "" || value == null) {

						var is_editor=false;

						if(!(window.tinyMCE === undefined)){

							if(tinyMCE.editors[frm.elements[cnt].name]){

								 is_editor=true;

							}

							else{

								 is_editor=false;

							}

						}

					//	alert(is_editor);

						

						if(is_editor){

							//alert(tinyMCE.editors[frm.elements[cnt].name].getContent());

							if(tinyMCE.editors[frm.elements[cnt].name].getContent()==""){

								alert("Please enter \"" + title + "\"");

								return(false);

							}

						}

						else{

							alert("Please enter \"" + title + "\"");

							ctl.focus()

							return (false);

						}

						

					}

					req = req.replace("MUST", "");

				}

				

				//Integer value check												[(MUST)INT]

				if (req.indexOf("INT") != -1) {

					if (isNaN(value)) {

						alert("Please enter numeric values for \"" + title + "\"");

						ctl.focus();

						return (false);

					}

					req = req.replace("INT", "");

					

					//Positive Integer Check										[(MUST)INT+]

					if (req.indexOf("+") != -1 && parseInt(value) <= 0) {

						alert("Please enter positive numerics for \"" + title + "\"");

						ctl.focus();

						return (false);

					}

					req = req.replace("+", "");

					

					//Negative Integer Check										[(MUST)INT-]

					if (req.indexOf("-") != -1 && parseInt(value) >= 0) {

						alert("Please enter negative numerics for \"" + title + "\"");

						ctl.focus();

						return (false);

					}

					req = req.replace("-", "");

					



					//Comparison Integer Check										[(MUST)INT<=X]

					if (req.indexOf("<=") != -1 && 

					(parseInt(value) > parseInt( req.substr(req.indexOf("<=")+2, req.length - req.indexOf("<=")) ))

					) {

						alert("Please enter numerics <= " + req.substr(req.indexOf("<=")+2, req.length - req.indexOf("<=")) + " for \"" + title + "\"");

						ctl.focus();

						return (false);

					}

					req = req.replace("<=", "");

					

					//																[(MUST)INT>=X]

					if (req.indexOf(">=") != -1 && 

					(parseInt(value) < parseInt( req.substr(req.indexOf(">=")+2, req.length - req.indexOf(">=")) ))

					) {

						alert("Please enter numerics >= " + req.substr(req.indexOf(">=")+2, req.length - req.indexOf(">=")) + " for \"" + title + "\"");

						ctl.focus();

						return (false);

					}

					req = req.replace(">=", "");

					

					continue;

				}

				

				

				//Double value check												[(MUST)DBL]

				if (req.indexOf("DBL") != -1) {

					if (isNaN(value)) {

						alert("Please enter numeric values for \"" + title + "\"");

						ctl.focus();

						return (false);

					}

					req = req.replace("DBL", "");

					

					//Positive Double Check											[(MUST)DBL+]

					if (req.indexOf("+") != -1 && parseFloat(value) <= 0) {

						alert("Please enter positive numerics for \"" + title + "\"");

						ctl.focus();

						return (false);

					}

					req = req.replace("+", "");

					

					//Negative Double Check											[(MUST)DBL-]

					if (req.indexOf("-") != -1 && parseFloat(value) >= 0) {

						alert("Please enter negative numerics for \"" + title + "\"");

						ctl.focus();

						return (false);

					}

					req = req.replace("-", "");

					



					//Comparison Double Check										[(MUST)DBL<=X]

					if (req.indexOf("<=") != -1 && 

					(parseFloat(value) > parseFloat( req.substr(req.indexOf("<=")+2, req.length - req.indexOf("<=")) ))

					) {

						alert("Please enter numerics <= " + req.substr(req.indexOf("<=")+2, req.length - req.indexOf("<=")) + " for \"" + title + "\"");

						ctl.focus();

						return (false);

					}

					req = req.replace("<=", "");

					

					//																[(MUST)DBL>=X]

					if (req.indexOf(">=") != -1 && 

					(parseFloat(value) < parseFloat( req.substr(req.indexOf(">=")+2, req.length - req.indexOf(">=")) ))

					) {

						alert("Please enter numerics >= " + req.substr(req.indexOf(">=")+2, req.length - req.indexOf(">=")) + " for \"" + title + "\"");

						ctl.focus();

						return (false);



					}

					req = req.replace(">=", "");

					

					continue;

				}

				

				//Characters and string value check

				if (req.indexOf("LEN") != -1) {

					if (req.indexOf("LEN=") != -1 && value.length != parseInt(req.substr(req.indexOf("LEN=")+4)) ) {

						alert("Please enter " + req.substr(req.indexOf("LEN=")+4) + " characters for " + title);

						ctl.focus();

						return (false);

					}

					

					if ( (req.indexOf("LEN<") != -1) && !(value.length <= parseInt(req.substr(req.indexOf("LEN<")+4))) ) {

						alert("Please enter atmost " + req.substr(req.indexOf("LEN<")+4) + " characters for " + title);

						ctl.focus();

						return (false);

					}

					

					if ( (req.indexOf("LEN>") != -1) && !(value.length >= parseInt(req.substr(req.indexOf("LEN>")+4))) ) {

//						alert(req.indexOf("|"))

						check = req.substr(0,req.indexOf("|")).length;

						if (check != 0) {

							alert("Please enter atleast " + req.substr(req.indexOf("LEN>")+4,check-4) + " characters for " + title);

						}

						else

						{

							alert("Please enter atleast " + req.substr(req.indexOf("LEN>")+4) + " characters for " + title);

						}

						ctl.focus();

						return (false);

					}

				}





				//user name; min 4 characters no special characters

				if (req.indexOf("USERNAME") != -1){					

					var re = /^[A-Za-z]\w{3,}$/; 

					if (!re.test(value)) {

						alert("Please choose a correct \"" + title + "\".");

						ctl.focus();

						return (false);

					}

				}





				

				if (req.indexOf("AGE18+") != -1) {									//[AGE18+]

					var string = value;

					var separator = '/';

					var stringArray = string.split(separator);

					mm=stringArray[1]

					dd=stringArray[0]

					yy=stringArray[2]

					thedate = new Date()

    				mm2 = thedate.getMonth() + 1

    				dd2 = thedate.getDate()

    				yy2 = thedate.getYear()

					    if (yy2 < 100) {

					        yy2 = yy2 + 1900 }

					    yourage = yy2 - yy

    					if (mm2 < mm) {

				        yourage = yourage - 1; }

					    if (mm2 == mm) {

				        	if (dd2 < dd) {

                			yourage = yourage - 1; }

        				}

    				agestring = yourage + " "

					if (parseInt(agestring) < 18) {

						alert("You should be 18+ to fill this form.");

						ctl.focus();

						return (false);

					}

					

					}



				

				//Character Checks

				

				

				//Date Checks														[DATE*][MMDDYY]

				if (req.indexOf("DATE") != -1 && value != "") {

					if (!isDate(value)) {

						alert("Please enter valid date for \"" + title + "\". [Format :mm/dd/yyyy]");

						ctl.focus();

						return (false);

					}

					

					

					if (req.indexOf("FUTURE") != -1) {

						

						var dt = new Date();

						var dtVal = new Date(value);

						

						if (dt > dtVal) {

							alert("Please enter a future date for \"" + title + "\"");

							ctl.focus();

							return (false);

						}

						req = req.replace("FUTURE", "");

					}

					

				}//DATE CHECK

				

				//EMAIL

				if (req.indexOf("EMAIL") != -1 && value != "") {

					if (!isValidEmailStrict(value)) {

						alert("Please enter valid " + title);

						ctl.focus();

						return (false);

					}

					

				}//EMAIL CHECK



				//Email confirmation

				if (req.indexOf("COMP") != -1 && value != "") 

				{

					req = req.replace("MUST", "");

					req = req.replace("COMP", "");

					var valemailc = trim(eval("frm." + req.toLowerCase() + ".value"));

					if (valemailc != value) {

						alert("Email Address Mismatched");

						return (false);

					}

				}// Email confirmation ends here

			}



//password; min of 4 characters but no special characters

			if (type == "PASSWORD") {

				if (value == "" || value == null) {

					alert("Please enter \"" + title + "\"");

					ctl.focus();

					return (false);

				}

				else

				{	

					if (req.indexOf("COMP") == -1){					

						if (value.length <= 3) {

							alert("Please enter \"" + title + "\" more than 4 characters.");

							ctl.focus();

							return (false);

						}

					}

					

				}



				//confirm password

				if (req.indexOf("COMP") != -1 && value != "") 

				{

					req = req.replace("MUST", "");

					req = req.replace("COMP", "");

					var valpwdc = trim(eval("frm." + req.toLowerCase() + ".value"));

					if (valpwdc != value) {

						alert("Password Mismatched");

						ctl.focus();

						return (false);

					}

					//var re = /\w{4,}/;

					var re =  /^[A-Za-z]\w{3,}/; 

					if (!re.test(value)) {alert("not valid password");

						ctl.focus();

					return (false);}

				}

			}



			if (type == "CHECKBOX") {

				if (ctl.checked == false) {

					alert("Please check \"" + title + "\" to proceed.");

					ctl.focus();

					return (false);

				}

			}

			

			if (ctl.tagName == "SELECT") {

				if (req.indexOf("MUST") != -1) {

					if (value == "" || value == null) {

					alert("Please select \"" + title + "\" to proceed.");

					ctl.focus();

					return (false);

					}

					req = req.replace("MUST", "");

				}

			}

			

			//Simple blnak value check											[MUST]

			if (type == "FILE") {

				if (req.indexOf("MUST") != -1) {

					if (value == "" || value == null) {

						alert("Please enter \"" + title + "\"");

						ctl.focus();

						return (false);

					}

					req = req.replace("MUST", "");

				}

			}//FILE IF

			

		}

	

	}



	return (true);



	

}















////////////////////////////////////////////////

////////////////STRING FUNCTIONS////////////////

////////////////////////////////////////////////

function trim( str ) {

		

	// Immediately return if no trimming is needed

	if( (str.charAt(0) != ' ') && (str.charAt(str.length-1) != ' ') ) { return str; }



	// Trim leading spaces

	while( str.charAt(0)  == ' ' ) {

		str = '' + str.substring(1,str.length);

	}

	// Trim trailing spaces

	while( str.charAt(str.length-1)  == ' ' ) {

		str = '' + str.substring(0,str.length-1);

	}

	return str;

}



// Remove characters that might cause security problems from a string 

function removeBadCharacters(string) {

	if (string.replace) {

		string.replace(/[<>\"\'%;\)\(&\+]/, '');

	}

	return string;

}



// Check that a string contains only letters

function isAlphabetic(string) {

	return isAlphabetic1(string, true);

}



function isAlphabetic1(string, ignoreWhiteSpace) {

	if (string.search) {

		if ((ignoreWhiteSpace && string.search(/[^a-zA-Z\s]/) != -1) || (!ignoreWhiteSpace && string.search(/[^a-zA-Z]/) != -1)) return false;

	}

	return true;

}



// Check that a string contains only numbers

function isNumeric(string) {

	return isNumeric1(string, false);

}



function isNumeric1(string, ignoreWhiteSpace) {

	if (string.search) {

		if ((ignoreWhiteSpace && string.search(/[^\d\s]/) != -1) || (!ignoreWhiteSpace && string.search(/\D/) != -1)) return false;

	}

	return true;

}



// Remove all spaces from a string

function trimAll(string) {

	var newString = '';

	for (var i = 0; i < string.length; i++) {

		if (string.charAt(i) != ' ') newString += string.charAt(i);

	}

	return newString;

}



// Check that a string contains only letters and numbers

function isAlphanumeric(string) {

	return isAlphanumeric1(string, false);

}

function isAlphanumeric1(string, ignoreWhiteSpace) {

	if (string.search) {

		if ((ignoreWhiteSpace && string.search(/[^\w\s]/) != -1) || (!ignoreWhiteSpace && string.search(/\W/) != -1)) return false;

	}

	return true;

}



// Check that the number of characters in a string is between a max and a min

function isValidLength(string, min, max) {

	if (string.length < min || string.length > max) return false;

	else return true;

}



// Check that an email address is valid based on RFC 821 (?)

function isValidEmail(address) {

	if (address.indexOf('@') < 1) return false;

	var name = address.substring(0, address.indexOf('@'));

	var domain = address.substring(address.indexOf('@') + 1);

	if (name.indexOf('(') != -1 || name.indexOf(')') != -1 || name.indexOf('\'') != -1 || name.indexOf('<') != -1 || name.indexOf('>') != -1 || name.indexOf(',') != -1 || name.indexOf(';') != -1 || name.indexOf(':') != -1 || name.indexOf('\\') != -1 || name.indexOf('"') != -1 || name.indexOf('[') != -1 || name.indexOf(']') != -1 || name.indexOf(' ') != -1) return false;

	if (domain.indexOf('(') != -1 || domain.indexOf(')') != -1 || domain.indexOf('<') != -1 || domain.indexOf('>') != -1 || domain.indexOf(',') != -1 || domain.indexOf(';') != -1 || domain.indexOf(':') != -1 || domain.indexOf('\\') != -1 || domain.indexOf('"') != -1 || domain.indexOf('[') != -1 || domain.indexOf(']') != -1 || domain.indexOf(' ') != -1) return false;

	return true;

}

// Check that an email address has the form something@something.something

// This is a stricter standard than RFC 821 (?) which allows addresses like postmaster@localhost

function isValidEmailStrict(address) {

	if (isValidEmail(address) == false) return false;

	var domain = address.substring(address.indexOf('@') + 1);

	if (domain.indexOf('.') == -1) return false;

	if (domain.indexOf('.') == 0 || domain.indexOf('.') == domain.length - 1) return false;

	return true;

}





////////////////////////////////////////////////

////////////////DATE VALIDATION/////////////////

////////////////////////////////////////////////

function isInteger(s){

	var i;

    for (i = 0; i < s.length; i++){   

        // Check that current character is number.

        var c = s.charAt(i);

        if (((c < "0") || (c > "9"))) return (false);

    }

    // All characters are numbers.

    return (true);

}

function stripCharsInBag(s, bag){

	var i;

    var returnString = "";

    // Search through string's characters one by one.

    // If character is not in bag, append to returnString.

    for (i = 0; i < s.length; i++){   

        var c = s.charAt(i);

        if (bag.indexOf(c) == -1) returnString += c;

    }

    return (returnString);

}

function daysInFebruary (year){

	// February has 29 days in any year evenly divisible by four,

    // EXCEPT for centurial years which are not also divisible by 400.

    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );

}

function DaysArray(n) {

	for (var i = 1; i <= n; i++) {

		this[i] = 31;

		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;}

		if (i==2) {this[i] = 29;}

   } 

   return (this);

}

function isDate(dtStr){

	var dtCh= "/";

	var minYear=1900;

	var maxYear=2100;

	

	var daysInMonth = DaysArray(12);

	var pos1 = dtStr.indexOf(dtCh);

	var pos2 = dtStr.indexOf(dtCh,pos1+1);

	var strMonth = dtStr.substring(0, pos1);

	var strDay = dtStr.substring(pos1+1,pos2);

	var strYear = dtStr.substring(pos2+1);

	strYr = strYear;

	if (strDay.charAt(0) == "0" && strDay.length > 1) strDay = strDay.substring(1);

	if (strMonth.charAt(0) == "0" && strMonth.length > 1) strMonth = strMonth.substring(1);

	for (var i = 1; i <= 3; i++) {

		if (strYr.charAt(0) == "0" && strYr.length > 1) strYr = strYr.substring(1);

	}

	month = parseInt(strMonth);

	day = parseInt(strDay);

	year = parseInt(strYr);

	if (pos1 == -1 || pos2 == -1){

		//alert("The date format should be : mm/dd/yyyy");

		return (false);

	}

	if (strMonth.length<1 || month<1 || month>12){

		//alert("Please enter a valid month");

		return (false);

	}

	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){

		//alert("Please enter a valid day");

		return (false);

	}

	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){

		//alert("Please enter a valid 4 digit year");// between "+minYear+" and "+maxYear);

		return (false);

	}

	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){

		//alert("Please enter a valid date");

		return (false);

	}

	

	return (true);

}



//

function checkAllCB(cb, blnVal) {

	var iCnt;

	for (iCnt=0; iCnt < cb.length; iCnt++) {

		cb[iCnt].checked = blnVal;

	}

}



function checkAllFRM(frm, blnVal) {

	var iCnt;

	for (iCnt=0; iCnt < frm.elements.length; iCnt++) {

		if (frm.elements[iCnt].type == 'checkbox') {

			frm.elements[iCnt].checked = blnVal;

		}

	}

}



function isAllChecked(cb, resCb) {

	var iCnt;

	for (iCnt=0; iCnt < cb.length; iCnt++) {

		if (!cb[iCnt].checked) {

			break;

		}

	}

	if (iCnt == cb.length)

		resCb.checked = true;

	else

		resCb.checked = false;

}



function isAnyCheckedFRM(frm, msg) {

	for (var iCnt = 0; iCnt < frm.elements.length; iCnt++) {

		if (frm.elements[iCnt].type.toLowerCase() == "checkbox") {

			if (frm.elements[iCnt].checked) {

				return (true);

			}

		}

	 }

	alert(msg);

	return (false);

}



//

function openFixedWindow(argURL, argSize) {

	window.open(argURL, "newWindow", "resizable=no," + argSize);

}



function openImageWindow(argURL, argSize) {

	window.open(argURL, "newImageWindow", "resizable=yes,scrollbars=yes," + argSize);

}



function clearCombo(varCombo) {

	for (var iCnt = varCombo.options.length; iCnt >= 0; --iCnt)

		varCombo.options[iCnt] = null;

}





function Highlight(e) {

	var r = null;

	

	r = document.getElementById("tr_" + e.value).className;

	

	if (r == "trListValue")

		r = "trListValue1";

	else

		r = "trListValue";

	

	document.getElementById("tr_" + e.value).className = r;

}



function createIDs(e) {

	var nm = e.name;

	var cb = eval("document.frmMain." + e.name);

	

	var t = "";

	var f = "";

	

	if (cb.length) {

		for (var i = 0; i < cb.length; i++) {

			if (cb[i].checked)

				t += "'" + cb[i].value + "',";

			else

				f += "'" + cb[i].value + "',";

		}

		t = t.substr(0, t.length - 1);

		f = f.substr(0, f.length - 1);

	}

	else {

		if (cb.checked)

			t = "'" + cb.value + "'";

		else

			f = "'" + cb.value + "'";

	}

	

	document.getElementById(nm.replace("cb_", "h_")).value = t + "|" + f;

}



function doChangeWay(ctl, val) {

	document.getElementById(ctl).value = val;

	//eval("document.frmMain." + ctl + ".value = val;");

	document.frmMain.submit();

}



function doChangeSort(argSort) {

	var sort = document.frmMain.sort.value;

	var order = document.frmMain.order.value.toLowerCase();

	

	if (sort == argSort) {

		if (order == "asc")

			order = "desc";

		else

			order = "asc";

	}

	else {

		order = "asc";

	}

	document.location = document.frmMain.action + "?sort=" + argSort + "&order=" + order;

}



var popUpWin=0;

function popUpWindow(URLStr,width,height,top,left)

{

  if(popUpWin)

  {

    if(!popUpWin.closed) popUpWin.close();

  }

  popUpWin = open(URLStr, 'SendSms', 'width='+width+',height='+height+',top='+top+',left='+left+'');

}



function messageWindow(title, msg)

{

  var width="300", height="125";

  var left = (screen.width/2) - width/2;

  var top = (screen.height/2) - height/2;

  var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;

  var msgWindow = window.open("","msgWindow", styleStr);

  var head = '<head><title>'+title+'</title></head>';

  var body = '<center>'+msg+'<br><p><form><input type="button" value="   Done   " onClick="self.close()"></form>';

  msgWindow.document.write(head + body);

}



function xmlhttp1(strURL,strupdate) 

{    

	//alert(strURL+"-------------"+strupdate) 

	var xmlHttpReq = false;

    var self = this;

	

    // Mozilla/Safari

    if (window.XMLHttpRequest) 

	{

        self.xmlHttpReq = new XMLHttpRequest();

    }

    // IE

    else if (window.ActiveXObject) 

	{

        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");

    }

    self.xmlHttpReq.open('POST', strURL, true);

    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    self.xmlHttpReq.onreadystatechange = function() 

	{

      if (self.xmlHttpReq.readyState == 4) 

	  {

	alert(self.xmlHttpReq.responseText);

		updatepage(self.xmlHttpReq.responseText,strupdate);

	  }

    }	

    self.xmlHttpReq.send('');

}

function updatepage(str,strnewdata)

{

	splitstr(str, "document.getElementById('" + strnewdata + "').options");

}

function splitstr(argstr, argctrl)

{

	var ctrl = eval(argctrl)

    var prezar = argstr.split("|");

    argctrl.length = 0;

	clearcombo(ctrl);

    for (o=0; o < prezar.length-1; o++)

    {

	  splitarr = prezar[o].split(":");

      ctrl[ctrl.length] = new Option(splitarr[1], splitarr[0]);

    }

}

function clearcombo(argctrl)

{

  for (var i=argctrl.length-1; i>=0; i--)

  {

    argctrl[i] = null;

  }

}







function hidearticle(id)

				{ 

					if (document.getElementById)

					{

					obj = document.getElementById('view'+id);

						if (obj.style.display == "")

						{ 

							obj.style.display = "none";

							document.getElementById('toga'+id).innerHTML="<strong><font color='#000000'>more...</font></strong><img src='images/more.gif' alt='click to show details' title='Click to show more details' />";

						} else {

							

							obj.style.display = "";

							document.getElementById('toga'+id).innerHTML="<strong><font color='#000000'>more...</font></strong><img src='images/hide.gif' alt='click to hide details' title='Click to hide more details' />";

						}

						

					}

				}

function showarticle(id)

				{

					if (document.getElementById)

					{

					obj = document.getElementById(id);

						if (obj.style.display == "none")

						{

							obj.style.display = "";

							} 

						

					}

				}







function checkAll(check)

						{

							var checked = check.checked;

							var col = document.getElementsByTagName("INPUT");

							for (var i=0;i<col.length;i++) 

							{

							col[i].checked= checked;

							}

						}



 

function xmlhttp1(strURL,strupdate) 

{    

	//alert(strURL+"-------------"+strupdate) 

	var xmlHttpReq = false;

    var self = this;

	

    // Mozilla/Safari

    if (window.XMLHttpRequest) 

	{

        self.xmlHttpReq = new XMLHttpRequest();

    }

    // IE

    else if (window.ActiveXObject) 

	{

        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");

    }

    self.xmlHttpReq.open('POST', strURL, true);

    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    self.xmlHttpReq.onreadystatechange = function() 

	{

      if (self.xmlHttpReq.readyState == 4) 

	  {

	//alert(self.xmlHttpReq.responseText);

		updatepage(self.xmlHttpReq.responseText,strupdate);

	  }

    }	

    self.xmlHttpReq.send('');

}

function updatepage(str,strnewdata)

{

	splitstr(str, "document.getElementById('" + strnewdata + "').options");

}

function splitstr(argstr, argctrl)

{

	var ctrl = eval(argctrl)

    var prezar = argstr.split("|");

    argctrl.length = 0;

	clearcombo(ctrl);

    for (o=0; o < prezar.length-1; o++)

    {

	  splitarr = prezar[o].split(":");

      ctrl[ctrl.length] = new Option(splitarr[1], splitarr[0]);

    }

}

function clearcombo(argctrl)

{

  for (var i=argctrl.length-1; i>=0; i--)

  {

    argctrl[i] = null;

  }

}





function showdiv(val)

{

if(val=1)

{

document.getElementById('amount').style.display='';

}

else

{

document.getElementById('amount').style.display='none';

}



}



function showdiv1(val)

{

if(val==0)

{

document.getElementById('display_msg').style.display='none';

}

else

{

document.getElementById('display_msg').style.display='';

}



}

function size1(valu,id2)

{

	//alert(valu);alert(valu);

	val=valu;

	//alert(val);

	

if(!document.getElementById("venture_capital").checked)

{

	

if(val>250)

{

document.form1.deal_size[1].selected = "1"

}

else if(val<=250 && val>=25)

{

document.form1.deal_size[2].selected = "1"

}

else if(val<25)

{

document.form1.deal_size[3].selected = "1"

}

//valu=document.form1.getElementById('deal_size');

if(val>0)

{

document.getElementById("deal_size").disabled="disabled";

}



}

}

function size2(val3,id2,venture_id)

{

//	alert(val3);alert(id2);

	val=val3;

	//alert(val);

	

if(!document.getElementById(venture_id).checked)

{

	

if(val>250)

{

document.getElementById(id2).options[1].selected = "1"

}

else if(val<=250 && val>=25)

{

document.getElementById(id2).options[2].selected = "1" 

}

else if(val<25)

{

document.getElementById(id2).options[3].selected = "1"

}

//valu=document.form1.getElementById('deal_size');

if(val>0)

{

document.getElementById(id2).disabled="disabled";

}



}

}



function hidearticle66(id)

				{ 

					if (document.getElementById)

					{

						

					obj = document.getElementById(id);

						if (obj.style.display == "")

						{ 

							obj.style.display = "none";

							document.getElementById('imag').innerHTML='<img src="fat-images/add.png" title="Add new customer" alt ="ADD new customer" height="20" width="20" style="cursor:pointer"/>';

						} else {

							

							obj.style.display = "";

							document.getElementById('imag').innerHTML='<img src="fat-images/minus.png" title="  Cancel to Add new customer" alt ="ADD new customer" height="20" width="20" style="cursor:pointer"/>';

						}

						

					}

				}

				

				

function sendmail()

{

//alert("virendra") ;

	var xmlHttpReq = false;

    var self = this;

	

    // Mozilla/Safari

    if (window.XMLHttpRequest) 

	{

        self.xmlHttpReq = new XMLHttpRequest();

    }

    // IE

    else if (window.ActiveXObject) 

	{

        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");

    }

	url="sendpasstoadmin.php?pass="+document.getElementById('cus_password').value;

	//alert(url);

    self.xmlHttpReq.open('POST', url, true);

    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    self.xmlHttpReq.onreadystatechange = function() 

	{

      if (self.xmlHttpReq.readyState == 4) 

	  {

	  document.getElementById('msg').innerHTML="<font color='#FF0000'><strong>"+self.xmlHttpReq.responseText+"</strong></font>";

	//alert(self.xmlHttpReq.responseText);

		//updatepage(self.xmlHttpReq.responseText,strupdate);

	  }

    }	

    self.xmlHttpReq.send('');

}



function select_div(id,sh)

				{ //alert(id);

				//alert(sh);

					if (document.getElementById)

					{

					obj = document.getElementById(id);

						if (obj.style.display == "")

						{ 

							obj.style.display = "none";

							document.getElementById(sh).innerHTML="<img src='fat-images/more.gif' alt='click to show details' title='Click to show more details' />";

						} else {

							

							obj.style.display = "";

							document.getElementById(sh).innerHTML="<img src='fat-images/hide4.gif' alt='click to hide details' title='Click to hide more details' />";

						}

						

					}

				}

				

				function select_div_dd(id,sh,flag)

				{ //alert(id);

				//alert(flag);

					if (document.getElementById)

					{

					obj = document.getElementById(id);

						if (obj.style.display == "")

						{ 

							obj.style.display = "none";

							if(flag=='hid'){

							document.getElementById(sh).innerHTML="SHOW";

							}

							else

							{

							document.getElementById(sh).innerHTML="SHOW ALL";

							}

						} else {

							

							obj.style.display = "";

							if(flag=='hid'){

							document.getElementById(sh).innerHTML="HIDE";

							}

							else

							{

							document.getElementById(sh).innerHTML="HIDE ALL";

							}

						}

						

					}

				}

	

	function fronthidearticle(id)

				{ 

					if (document.getElementById)

					{

					obj = document.getElementById('view'+id);

						if (obj.style.display == "")

						{ 

							obj.style.display = "none";

							document.getElementById('toga'+id).innerHTML="More...<img src='fat-images/more.gif' alt='click to show details' title='Click to show more details' />";

						} else {

							

							obj.style.display = "";

							document.getElementById('toga'+id).innerHTML="More...<img src='fat-images/hide4.gif' alt='click to hide details' title='Click to hide more details' />";

						}

						

					}

				}

				

				

				

				

				function dealsonly(id,sh)

				{ //alert(id);

				//alert(sh);

					if (document.getElementById)

					{

						obj1 = document.getElementById(sh);

					obj = document.getElementById(id);

						if (obj.style.display == "")

						{ 

							obj.style.display = "none";

							obj1.style.display = "none";

							document.getElementById('dl').innerHTML="";

						} 

						

					}

				}

				

				

				function orederrep(id)

				{ //alert(id);

				//alert(sh);

					if (document.getElementById)

					{

						obj = document.getElementById(id);

						if (obj.style.display == "none")

						{ 

							obj.style.display = "";

						} 

						

					}

				}

				

				

				

function addValueRange(typeid, val1, val2)

{

	var tbl = document.getElementById('rangeTable'+typeid);

	var lastRow = tbl.rows.length;

	var iteration = lastRow;

	var row = tbl.insertRow(lastRow);



	id=lastRow;

	//row.setAttribute("name","div_"+id);

	row.setAttribute("id","rangetable"+typeid+'row'+id);





	var cellItemName= row.insertCell(0);

	cellItemName.setAttribute("align","center");

	cellItemName.setAttribute("width","45%");

	cellItemName.setAttribute("style", "padding: 3px;");



	var el = document.createElement('input');

	el.setAttribute('type', 'text');

	el.setAttribute('name', 'minrange'+typeid+'[]');

	el.setAttribute('id', 'minrange'+typeid);

	el.setAttribute('size', '10');

	el.setAttribute('value', val1);

	el.setAttribute('onchange',"adv_Search_count();");

	cellItemName.appendChild(el);



	var cellItemCost= row.insertCell(1);

	cellItemCost.setAttribute("align","center");

	cellItemCost.setAttribute("width","45%");

	var el = document.createElement('input');

	el.setAttribute('type', 'text');

	el.setAttribute('name', 'maxrange'+typeid+'[]');

	el.setAttribute('id', 'maxrange'+typeid);

	el.setAttribute('size', '10');

	el.setAttribute('value', val2);

	el.setAttribute('onchange',"adv_Search_count();");

	cellItemCost.appendChild(el);

	

	var cellItemRemove = row.insertCell(2);

	cellItemRemove.setAttribute("align", "right");

	cellItemRemove.setAttribute("width", "10%");

	var str="<a href='javascript:void(0);' onclick=\"" + "removeValueRange('" + typeid + "', '" + id + "');" + "\">";

	str += "<img src='fat-images/hidedet.png'></a>";

	cellItemRemove.innerHTML=str;

	/*var el = document.createElement('IMG');

	el.setAttribute('src',"fat-images/hidedet.png");

	var str="removeValueRange('" + typeid + "', '" + id + "');";

	str="alert('aa');";

	el.setAttribute('onclick', str);

	el.setAttribute('id', 'img234');

	

	cellItemRemove.appendChild(el);*/

}	

function removeValueRange(typeid, id){

	var tbl = document.getElementById('rangeTable'+typeid);

	var str="rangetable"+typeid+'row'+id;

	for(i=1;i < tbl.rows.length; i++){

		rowid=tbl.rows[i].getAttribute("id");

		if(rowid==str){

			tbl.deleteRow(i);

			adv_Search_count();

			return;

		}

	}

}



function addOverallValueRange(val1, val2)

{

	var tbl = document.getElementById('valuerange');

	var lastRow = tbl.rows.length;

	var iteration = lastRow;

	var row = tbl.insertRow(lastRow);

	

	id=lastRow;

	if(lastRow>1){

		id=(Number(tbl.rows[lastRow-1].getAttribute("id").substr(17))+1);

	}

	row.setAttribute("id","overallValueRange"+id);





	var cellItemName= row.insertCell(0);

	cellItemName.setAttribute("width","45%");

	cellItemName.setAttribute("style", "padding: 3px;");



	

	cellItemName.innerHTML='<b>&euro;</b> <input type="text" name="start[]" id="start" size="10" value="'+val1+'" onchange="showvaluerange(); adv_Search_count();"> <b>M</b>';



	var cellItemCost= row.insertCell(1);

	cellItemCost.setAttribute("width","45%");

	

	cellItemCost.innerHTML='<b>&euro;</b> <input type="text" name="end[]" id="end" size="10" value="'+val2+'" onchange="showvaluerange(); adv_Search_count();"> <b>M</b>';

	

	var cellItemRemove = row.insertCell(2);

	//cellItemRemove.setAttribute("align", "right");

	cellItemRemove.setAttribute("width", "10%");

	var str="<a href='javascript:void(0);' onclick=\"" + "removeOverallValueRange('" + id + "');" + "\">";

	str += "<img src='fat-images/hidedet.png' border='0'></a>";

	cellItemRemove.innerHTML=str;

	showvaluerange();

}

function removeOverallValueRange(id){

	var tbl = document.getElementById('valuerange');

	var str="overallValueRange"+id;

	for(i=1;i < tbl.rows.length; i++){

		rowid=tbl.rows[i].getAttribute("id");

		if(rowid==str){

			tbl.deleteRow(i);

			var el=document.mainform.deal_type;

			/*for(var j=0; j < el.length; j++){

				if(!el[j].checked) continue;

				var tblundisclosed=document.getElementById('rangeTable'+el[j].value);

				tblundisclosed.deleteRow(i-1);

			}*/

			updateUndisclosedRange();

			adv_Search_count();

			

			return;

		}

	}

	

}



function addUndisclosedRange(typeid, n){

	/*var tbl=document.getElementById('rangeTable'+typeid);

	

	var id=(document.getElementById('valuerange').rows[n+1].getAttribute('id').substr(17));

	if(document.getElementById('undisclosedRow_'+typeid+'_'+id)) return;

	var row=tbl.insertRow(n);

	row.setAttribute('id', 'undisclosedRow'+'_'+typeid+'_'+id);

	var cellItem=row.insertCell(0);

	cellItem.setAttribute('width', '5%');

	cellItem.innerHTML='<input type="checkbox" name="undisclosed'+typeid+'[]" id="undisclosed'+typeid+'" onclick="adv_Search_count();">';

	

	var cellDisplay=row.insertCell(1);

	cellDisplay.setAttribute('width', '95%');

	cellDisplay.setAttribute('id', 'tdundisclosed_'+typeid+'_'+id);

	cellDisplay.innerHTML='Show';*/

	

	

}



function updateUndisclosedRange(){

	/*var tblRange=document.getElementById('valuerange');

	var elstart=document.mainform.start;

	var elend=document.mainform.end;

	if(!elstart) return;

	var start=new Array();

	var end=new Array();

	if(!elstart.length){

		start[0]=elstart.value;

		end[0]=elend.value;

	}

	else{

		for(var i=0; i < elstart.length; i++){

			start[i]=elstart[i].value;

			end[i]=elend[i].value;

		}

	}

	var id='';

	for(var i=0; i < tblRange.rows.length-1; i++){

		id=tblRange.rows[i+1].getAttribute('id').substr(17);

		for(var j=0; j < document.mainform.deal_type.length; j++){

			if(!document.mainform.deal_type[j].checked) continue;

			var typeid=document.mainform.deal_type[j].value;

			var capt=document.mainform.deal_type[j].title;

			document.getElementById('tdundisclosed_'+typeid+'_'+id).innerHTML='Show ' + capt + ' (' + start[i] + ' M&euro; to ' + end[i] + ' M&euro;) Deals that have undisclosed Deal Values';

			if(!document.mainform.elements['undisclosed'+typeid].length){

				document.mainform.elements['undisclosed'+typeid].value=start[i]+ '-' + end[i];

			}

			else{

				document.mainform.elements['undisclosed'+typeid][i].value=start[i]+ '-' + end[i];

			}

			//document.mainform.elements['undisclosed'+typeid][i].value=start[i]+ '-' end[i];

		}

	}*/

	

	var smallselected=false;

	var midselected=false;

	var bigselected=false;

	

	var elstart=document.mainform.start;

	var elend=document.mainform.end;

	if(!elstart) return;

	var start=new Array();

	var end=new Array();

	if(!elstart.length){

		start[0]=elstart.value;

		end[0]=elend.value;

	}

	else{

		for(var i=0; i < elstart.length; i++){

			start[i]=elstart[i].value;

			end[i]=elend[i].value;

		}

	}

	for(i=0; i < start.length; i++){

		var smallselected1=false;

		var midselected1=false;

		var bigselected1=false;

		if((small_size_min <= start[i] && small_size_max >= start[i]) || (small_size_min <= end[i] && small_size_max >= end[i])){

			var smallselected1=true;

		}

		if((mid_size_min <= start[i] && mid_size_max >= start[i]) || (mid_size_min <= end[i] && mid_size_max >= end[i])){

			var midselected1=true;

		}

		if((big_size_min <= start[i]) || (big_size_min <= end[i])){

			var bigselected1=true;

		}

		if(smallselected1 && bigselected1) midselected1=true;

		if(smallselected1) smallselected=true;

		if(midselected1) midselected=true;

		if(bigselected1) bigselected=true;

	}

	for(var i=0; i < document.mainform.deal_type.length; i++){

		var val=document.mainform.deal_type[i].value;

		var row=document.getElementById('trundisclosed_'+val+'_small');

		if(smallselected){

			row.style.display='';

		}

		else{

			row.style.display='none';

			document.mainform.elements['undisclosed'+val][0].checked=false;

		}

		

		var row=document.getElementById('trundisclosed_'+val+'_mid');

		if(midselected){

			row.style.display='';

		}

		else{

			row.style.display='none';

			document.mainform.elements['undisclosed'+val][1].checked=false;

		}

		

		var row=document.getElementById('trundisclosed_'+val+'_big');

		if(bigselected){

			row.style.display='';

		}

		else{

			row.style.display='none';

			document.mainform.elements['undisclosed'+val][2].checked=false;

		}

	}

}





function goToPage(strUrl, strDiv, strMsg){

	ttlightbox(strUrl,strDiv);

	//doAjax(strUrl,"",strDiv,"GET",strMsg,0);

}

function showdls(id,id2,id3)

{ 



					if (document.getElementById)

					{

					obj = document.getElementById(id);

					obj2 = document.getElementById(id2);

					obj3 = document.getElementById(id3);

						if (obj.style.display == "")

						{ 

							obj.style.display = "none";

							obj3.style.display = "none";

														

						} else {

							

							obj.style.display = "";

							obj2.style.display = "none";

							obj3.style.display = "none";

							

						}

						

					}

				}

function DisablePage()

{

	if(document.getElementById("divIdName")==null)

	{

		divtemp = document.createElement("div");

		divtemp.style.top = 0;

		divtemp.style.left = 0;

		divtemp.style.height = window.document.body.clientHeight;

		divtemp.style.width = window.document.body.clientWidth;

		divtemp.style.position = "absolute";

		divtemp.id = "divIdName";

		divtemp.className = 'disablePage';

		divtemp.style.zIndex = 998;

		document.body.appendChild(divtemp);

	}

	else

	{

		document.getElementById("divIdName").style.display='block';

	}

	document.getElementById("divIdName").innerHTML='<br><br><br><br><img src="fat-images/ajax2.gif"><br>Loading...';

	/*alert("asd");

	document.getElementById("divIdName").style.display='none';*/

}				







function addfav(id)

				{ 

					if (document.getElementById)

					{

					obj = document.getElementById(id);

						if (obj.style.display == "")

						{ 

							obj.style.display = "none";

							

						} else {

							

							obj.style.display = "";

							

						}

						

					}

				}

 function passchk(pass, conpass)

{

var password=document.getElementById(pass).value;

var cpassword=document.getElementById(conpass).value;

if(password!=cpassword)

{

alert("Password and confirm password are not matched!");

document.getElementById(conpass).focus();

return false;



}

else 

{

return true;

}

}

function selectListings(frm,obj)

	{

		

		var i=0;

		var flag=false;

		if (frm.listing_id.length==null)

		{

			frm.listing_id.checked=obj.checked;

			flag=true;

		}

		else

		{

			

			for (i=0;i<frm.listing_id.length;i++)

			{

				frm.listing_id[i].checked=obj.checked;

				flag=true;

			}

			

		}

	}	

	function func_check(frm)

{

var total = 0;

if(!document.form2.listing_id)

{

 return;

alert("No conversation selected");

}

var maxi = (document.form2.listing_id.length)?document.form2.listing_id.length:1;//alert('vi');

//alert(maxi);



		if(maxi>1){

			for(var i=0;i<maxi;i++)

			{

				if((document.form2.listing_id[i].checked)==true)

				{

				var a = new Array();

				a[total]=document.form2.listing_id[i].value;

				total=total+1;

			}

		}

		}

				else{

					if((document.form2.listing_id.checked))

						{

						total=total+1;

						}

				   }



		if(total<1)

		{

		alert("No conversation selected");

		return false;

		}

		return true;

}	 



function globalshowhide(id, img)

				{ 

					if (document.getElementById)

					{

					var obj = document.getElementById(id);

					var imgs = document.getElementById(img);

						if (obj.style.display == "")

						{ 

							obj.style.display = "none";

							imgs.innerHTML = "Select Language...<img src='images/more.gif' alt='click to hide languages' title='click to add languages' />";

						} else {

							

							obj.style.display = "";

							imgs.innerHTML = "Select Language...<img src='images/indicator11_new.gif' height='17' width='21' alt='click to add languages' title='click to hide languages' />";

						}

						

					}

				}
function globalshowhide_tt(id, img)

				{ 

					if (document.getElementById)

					{

					var obj = document.getElementById(id);

					var imgs = document.getElementById(img);

						if (obj.style.display == "")

						{ 

							obj.style.display = "none";

							imgs.innerHTML = "Select Experiences...<img src='images/more.gif' alt='click to hide Experience' title='click to add Experience' />";

						} else {

							

							obj.style.display = "";

							imgs.innerHTML = "Select Experiences...<img src='images/indicator11_new.gif' height='17' width='21' alt='click to hide Experience' title='click to hide Experience' />";

						}

						

					}

				}
				

				function globalshowhide_new(id, img)

				{ 

					if (document.getElementById)

					{

					var obj = document.getElementById(id);

					var imgs = document.getElementById(img);

						if (obj.style.display == "")

						{ 

							obj.style.display = "none";

							imgs.innerHTML = "Exclude People with the following nationalities:&nbsp;<img src='images/more.gif' alt='click to add Nationality Criteria' title='click to Nationality Criteria' />";

						} else {

							

							obj.style.display = "";

							imgs.innerHTML = "Exclude People with the following nationalities:&nbsp;<img src='images/indicator11_new.gif' height='17' width='21' alt='click to hide Nationality Criteria' title='click to hide Nationality Criteria' />";

						}

						

					}

				}

				

function trim(s)

{

	return rtrim(ltrim(s));

	

}



function ltrim(s)

{

	var l=0;

	while(l < s.length && s[l] == ' ')

	{	l++; }

	return s.substring(l, s.length);

}



function rtrim(s)

{

	var r=s.length -1;

	while(r > 0 && s[r] == ' ')

	{	r-=1;	}

	return s.substring(0, r+1);

}



function checkSpace(frm)

{

for (ct=0; ct < frm.elements.length; ct++) {

req = frm.elements[ct].lang;

if (req != "" && req != null && req != "0") {

		ctl = frm.elements[ct];           

		

			value = trim(frm.elements[ct].value);

		title = frm.elements[ct].title;

		

		req = req.toUpperCase();

											

				if (req.indexOf("MUST") != -1) {

					if (value == "" || value == null) {

						alert("Please insert the value for \"" + title + "\"");

						ctl.focus()

						return (false);

					}

				

				}

		

		                                   }

}

}



function callAjax(strURL,strPostData,thefunction) {

    var xmlHttpReq = false;

    var self = this;

	var msg="";

    // Mozilla/Safari

	

	www=(window.location.href.toLowerCase().indexOf("//www.")>0)?"http://www.":"http://";

	strURL=strURL.replace("http://",www);



    if (window.XMLHttpRequest) {

        self.xmlHttpReq = new XMLHttpRequest();

    }

    // IE

    else if (window.ActiveXObject) {

        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");

    }

    self.xmlHttpReq.open('POST', strURL, true);

    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    self.xmlHttpReq.onreadystatechange = function() {

		

        if (self.xmlHttpReq.readyState == 4) 

		{

			thefunction(self.xmlHttpReq.responseText);

		}

		else

		{

			//alert(self.xmlHttpReq.readyState);

		}

    }

	

    self.xmlHttpReq.send(strPostData);

}



function gotopage(url, divid){

	document.getElementById(divid).innerHTML='<div style="text-align:center; margin-top:100px; margin-bottom:100px;">Loading..............</div>';

	callAjax(url, '', function(t){

							   document.getElementById(divid).innerHTML=t;

							   }

	);

}



function toggleShowHide(id){

	var el=document.getElementById(id);

	if(!el) return;

	el.style.display=(el.style.display=='none')?'':'none';

}



function getSelectedCheckBoxes(el){

	if(!el) return '';

	if(!el.length && el.checked) return el.value;

	var vals='';

	for(var i=0; i < el.length; i++){

		if(el[i].checked){

			if(vals != '') vals += ',';

			vals += el[i].value;

		}

	}

	return vals;

}



function addCVToCart(id){

	callAjax('cv-cart-functions.php', 'action=add&id='+id, function(t){

																	alert(t);

																	}

			 );

	

}