var currentErrorParent = null;
var isError = false;
var _base = "http://www.malayogamonline.com/";
//var _base = "http://192.168.0.112/malnew/";
var rq = null;
var _index = "index.php";
var th_base = _base+_index+"/profile/thumb/";
var ad_base = _base+_index+"/profile/thumb_user/";
var ph_base = _base+_index+"/profile/photo/";
var up_base = _base+_index+"/profile/photo_user/";
var newleft=0,newtop=0,newwidth=0,newheight=0;

function trim(str) 
{
	return str.replace(/^\s+|\s+$/g,"");
}
function getFranchiseeCity(src,trg,def)
{
	initCombo(trg);
	if(src.selectedIndex == 0) return;
	url = _base + _index +'/ajax_call/get_franchisee_city/'+src.value+'/'+def+'/'+Math.random()+'/'; 
	rq = new Request(
					  { url : url,
					  	method:'get',
						onSuccess: function(responseText)
						{
							
							tmp = new Element('form',{name:'frmdata'}).set('html',responseText);
							trg.options.length = 0;
							for(i=0;i<tmp.elements['tmp_element'].options.length;i++)
							trg.appendChild(new Element('option',{value:tmp.elements['tmp_element'].options[i].value,
																text:tmp.elements['tmp_element'].options[i].text}));
						}
					  }
					  );
	rq.send();
}
function getFranchiseeName(src,trg,def)
{
	initCombo(trg);
	if(src.selectedIndex == 0) return;
	if(!def) def = '';
	rq = new Request(
					  { url:_base + _index +'/ajax_call/get_franchisee_name/'+src.value+'/'+def+'/'+Math.random()+'/',
					  	method:'get',
						onSuccess: function(responseText)
						{
							
							tmp = new Element('form',{name:'frmdata'}).set('html',responseText);
							trg.options.length = 0;
							for(i=0;i<10000000;i++)
							trg.appendChild(new Element('option',{value:tmp.elements['tmp_element'].options[i].value,
																text:tmp.elements['tmp_element'].options[i].text}));
						}
					  }
					  );
	rq.send();
}
function getFranchiseeAddress(src,trg,def)
{
	if(src.selectedIndex == 0) return;
	rq = new Request(
					  { url:_base + _index +'/ajax_call/get_franchisee_address/'+src.value+'/'+Math.random()+'/'+def,
					  	method:'get',
						onSuccess: function(responseText)
						{
							trg.innerHTML = '';
							trg.appendChild(new Element('span').set('html',responseText));
						}
					  }
					  );
	rq.send();
}
function doSearch()
{
	window.location.href = _base+_index+'/search_profile';
} 
function initCombo(el)
{
	el.options.length = 0;
	el.appendChild(new Element('option',{value:'---',text:'..loading..'}));
}
function focusMe()
{
	window.focus();
}
function getCasteFor(src,trg,def)
{
	initCombo(trg);
	if(!def) def = '';
	rq = new Request(
					  { url:_base + _index +'/ajax_call/get_caste/'+src.value+'/'+Math.random()+'/'+def,
					  	method:'get',
						onSuccess: function(responseText)
						{
							
							tmp = new Element('form',{name:'frmdata'}).set('html',responseText);
							trg.options.length = 0;
							for(i=0;i<tmp.elements['tmp_element'].options.length;i++)
							trg.appendChild(new Element('option',{value:tmp.elements['tmp_element'].options[i].value,
																text:tmp.elements['tmp_element'].options[i].text}));
						}
					  }
					  );
	rq.send();
}
function getSubCasteFor(src,trg,def)
{
	initCombo(trg);
	if(!def) def = '';
	rq = new Request(
					  { url:_base + _index +'/ajax_call/get_subcaste/'+src.value+'/'+Math.random()+'/'+def,
					  	method:'get',
						onSuccess: function(responseText)
						{
							
							tmp = new Element('form',{name:'frmdata'}).set('html',responseText);
							trg.options.length = 0;
							for(i=0;i<tmp.elements['tmp_element'].options.length;i++)
							trg.appendChild(new Element('option',{value:tmp.elements['tmp_element'].options[i].value,
																text:tmp.elements['tmp_element'].options[i].text}));
							
						}
					  }
					  );
	rq.send();
}
function getCasteForPartner(src,trg,def)
{
	initCombo(trg);
	if(!def) def = '';
	rq = new Request(
					  { url:_base + _index +'/ajax_call/get_caste_partner/'+src.value+'/'+Math.random()+'/'+def,
					  	method:'get',
						onSuccess: function(responseText)
						{
							
							tmp = new Element('form',{name:'frmdata'}).set('html',responseText);
							trg.options.length = 0;
							for(i=0;i<tmp.elements['tmp_element'].options.length;i++)
							trg.appendChild(new Element('option',{value:tmp.elements['tmp_element'].options[i].value,
																text:tmp.elements['tmp_element'].options[i].text}));
						}
					  }
					  );
	rq.send();
}
function getSubCasteForPartner(src,trg,def)
{
	initCombo(trg);
	if(!def) def = '';
	rq = new Request(
					  { url:_base + _index +'/ajax_call/get_subcaste_partner/'+src.value+'/'+Math.random()+'/'+def,
					  	method:'get',
						onSuccess: function(responseText)
						{
							
							tmp = new Element('form',{name:'frmdata'}).set('html',responseText);
							trg.options.length = 0;
							for(i=0;i<tmp.elements['tmp_element'].options.length;i++)
							trg.appendChild(new Element('option',{value:tmp.elements['tmp_element'].options[i].value,
																text:tmp.elements['tmp_element'].options[i].text}));
							
						}
					  }
					  );
	rq.send();
}
function getStateFor(src,trg,def)
{
	initCombo(trg);
	if(!def) def = '';
	rq = new Request(
						  { url:_base + _index +'/ajax_call/get_state/'+src.value+'/'+Math.random()+'/'+def,
							method:'get',
							onSuccess: function(responseText)
							{
								tmp = new Element('form',{name:'frmdata'}).set('html',responseText);
								trg.options.length = 0;
								for(i=0;i<tmp.elements['tmp_element'].options.length;i++)
								trg.appendChild(new Element('option',{value:tmp.elements['tmp_element'].options[i].value,
																text:tmp.elements['tmp_element'].options[i].text}));
							}
						  }
					  );
	rq.send();
}
function username(src,trg)
{
	src.value = trg.value;
}
function getCountryCode(src,trg)
{
	for(i=0;i<trg.options.length;i++)
	if(src.value==trg.options[i].value) trg.selectedIndex = i;
}
function getPlaceFor(src,trg,def)
{
	initCombo(trg);
	if(!def) def = '';
	rq = new Request(
						  { url:_base + _index +'/ajax_call/get_place/'+src.value+'/'+Math.random()+'/'+def,
							method:'get',
							onSuccess: function(responseText)
							{
								tmp = new Element('form',{name:'frmdata'}).set('html',responseText);
								trg.options.length = 0;
								for(i=0;i<tmp.elements['tmp_element'].options.length;i++)
								trg.appendChild(new Element('option',{value:tmp.elements['tmp_element'].options[i].value,
																text:tmp.elements['tmp_element'].options[i].text}));
							}
						  }
					  );
	rq.send();
} 

function getHoroStateFor(src,trg)
{
	//alert(trg.tagName);
	if(src.value == '0') return;
	initCombo(trg);
	rq = new Request(
						  { url:_base + _index +'/ajax_call/get_horo_state/'+src.value+'/0/'+'Select'+'/'+Math.random()+'/',
							method:'get',
							onSuccess: function(responseText)
							{
								tmp = new Element('form',{name:'frmdata'}).set('html',responseText);
								trg.options.length = 0;
								//alert(tmp.elements['tmp_element'].options.length);
								for(i=0;i<tmp.elements['tmp_element'].options.length;i++)
								trg.appendChild(new Element('option',{value:tmp.elements['tmp_element'].options[i].value,
																text:tmp.elements['tmp_element'].options[i].text}));
							}
						  }
					  );
	rq.send();
} 

function getHoroPlaceFor(src,trg)
{
	if(src.value == '0') return;
	initCombo(trg);
	rq = new Request(
						  { url:_base + _index +'/ajax_call/get_horo_place/'+src.value+'/0/Select/'+Math.random()+'/',
							method:'get',
							onSuccess: function(responseText)
							{
								tmp = new Element('form',{name:'frmdatasad'}).set('html',responseText);
								trg.options.length = 0;
								/*for(i=0;i<1000;i++)
								{
									trg.appendChild(tmp.elements['tmp_element'].options[i]);
									
								}*/
								for(i=0;i<tmp.elements['tmp_element'].options.length;i++)
								trg.appendChild(new Element('option',{value:tmp.elements['tmp_element'].options[i].value,
																text:tmp.elements['tmp_element'].options[i].text}));
							}
						  }
					  );
	
	rq.send();

} 
function loadAutoComplete(name,tId)
{
		var _param = {id:'ac_place',name:name,cssclass:'autocomplete',datacall:'get_place_by_name',width:220};
		var x = new AutoComplete(_param);
		x.attachto(tId);
}
function get_place_by_name(el,tb)
{
	tb = $(tb); 
	if(tb.value.length > 3 ) 
	{
			$(el).set('html','loading');
			rq = new Request(
							  { url: _base + _index +'/ajax_call/get_horo_place_name/'+tb.value+'/'+Math.random()+'/',
								method:'get',
								onSuccess: function(responseText)
								{
									js  = eval('('+responseText+')');
									$(el).set('html','');
									if(js.data.length ==0) $(el).set('html','not found');
									else
									{
										for( i=0;i < js.data.length ; i++ ) 
										{
											/* an = new Element('a', 
											{ href:"javascript:setValue('"+$(el).id+"','"+tb.id+"','"+js.data[i].text+"','"+
																			js.data[i].value+"')"}).set('html',js.data[i].text);*/
											an = new Element('option',{ value: js.data[i].value,text:js.data[i].text });
											$(el).appendChild(an);
										}
										$(el).selectedIndex = 0;
									}
								}
							  }
						  );
		rq.send();
	}
}
function setValue(val,fld) 
{
	fld.value = val;
}
function setLatitude(src,form)
{
	if(src.indexOf('#') >= 0) 
	{
		var pos = src.split('#');
		form.longitude_deg.value 	= pos[0];
		form.longitude_min.value 	= pos[1];
		form.long_dir.value 	 	= pos[2];
		form.latitude_deg.value 	= pos[3];
		form.latitude_min.value 	= pos[4];
		form.lat_dir.value 			= pos[5];
		form.time_zone.value 		= pos[6];
	}
	form.hd_place.value = form.horo_place.options[form.horo_place.selectedIndex].text;
	
}
function getPhotoForCropAdmin(elm,pid,sz,val,tot)
{
	vp = val - 1;	vn = val + 1; 
	pl = 'javascript:getPhotoForCropAdmin($("'+elm.id+'"),"'+pid+'",'+sz+','+vp+','+tot+')';
	nl = 'javascript:getPhotoForCropAdmin($("'+elm.id+'"),"'+pid+'",'+sz+','+vn+','+tot+')';
	if($('div_'+elm.id+pid)) elm.parentNode.removeChild($('div_'+elm.id+pid));
	if(tot > 0)
	{
		document.getElementById("cuur_photo_index").value = val;
		//var _url = th_base+pid+'/'+sz+'/'+val+'/'+tot;//old
		var _url = _base+"u_data/u_photo/p_"+pid+"-"+val+"?r="+Math.random();//org src
		//var _url = up_base+pid+'/'+sz+'/'+val;//changed to full but wartermark 		
		//var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" class="crp" />';
		var di = '<img src="'+_url+'" class="crp" id="cropp" name="org_src" border="1px"/>';
		elm.set('html',di);
		//elm.setStyle('background','url('+_url+') no-repeat center center').set('html',di);
		if(val == tot)		an = new Element('small',{'class':'nd'}).set('html','&nbsp;&nbsp;&nbsp;');
		else				an = new Element('a',{href:nl,'class':'nl'}).set('html','&nbsp;&nbsp;&nbsp;');
		
		if(val == 1)		ap = new Element('small',{'class':'pd'}).set('html','&nbsp;&nbsp;&nbsp;');	
		else				ap = new Element('a',{href:pl,'class':'pl'}).set('html','&nbsp;&nbsp;&nbsp;');	
		
		var asp = new Element('div',{	'class':'tc',id:'div_'+elm.id+pid,style:'width:'+sz+'px'});
			asp.appendChild(ap); 
			asp.appendChild(new Element('small').set('html','&nbsp;'+val+' of '+tot+'&nbsp;'));	
			asp.appendChild(an); 
		elm.parentNode.appendChild(asp); 
		startcrop();
	}
	else 
	{	
		//var _url = th_base+0+'/'+sz+'/'+val;
		var _url = _base+"/u_data/u_photo/p_NoPhotoImage-1";
		/*var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" class="crp"'+
				 ' title="click to request photo" onclick="requestPhoto(\''+pid+'\')"/>';*/
		var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" class="crp"'+
				 ' title="photo not provided"/>';
		elm.setStyle('background','url('+_url+') no-repeat center center').set('html',di);
		var asp = new Element('div',{	align:'center'}); 
		/*an = new Element('a',{href:"javascript:requestPhoto('"+pid+"')"}).set('html','request');
		asp.appendChild(an);*/
		elm.parentNode.appendChild(asp);
	}	
	
}


function getPhotoFor(elm, pid, size, val, tot)
{
	if (size == 'FP')
		sz = '150';
	else
		sz = size;

	vp = val - 1;	vn = val + 1; 
	pl = 'javascript:getPhotoFor($("'+elm.id+'"),"'+pid+'",'+sz+','+vp+','+tot+')';
	nl = 'javascript:getPhotoFor($("'+elm.id+'"),"'+pid+'",'+sz+','+vn+','+tot+')';
	if($('div_'+elm.id+pid)) elm.parentNode.removeChild($('div_'+elm.id+pid));
	if(tot > 0)
	{
		var _url = th_base+pid+'/'+sz+'/'+val+'/'+tot;
		var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" class="crp" onclick="popupPhoto(\''+
																										pid+'\')"/>';
		elm.setStyle('background','url('+_url+') no-repeat center center').set('html',di);
		if(val == tot)		an = new Element('small',{'class':'nd'}).set('html','&nbsp;&nbsp;&nbsp;');
		else				an = new Element('a',{href:nl,'class':'nl'}).set('html','&nbsp;&nbsp;&nbsp;');
		
		if(val == 1)		ap = new Element('small',{'class':'pd'}).set('html','&nbsp;&nbsp;&nbsp;');	
		else				ap = new Element('a',{href:pl,'class':'pl'}).set('html','&nbsp;&nbsp;&nbsp;');
		
		if (size == 'FP')
			sz = '135';
		
		var asp = new Element('div',{	'class':'tc',id:'div_'+elm.id+pid,style:'width:'+sz+'px'});
			asp.appendChild(ap); 
			asp.appendChild(new Element('small').set('html','&nbsp;'+val+' of '+tot+'&nbsp;'));	
			asp.appendChild(an); 
		elm.parentNode.appendChild(asp); 
	}
	else 
	{	
		var _url = th_base+0+'/'+sz+'/'+val;
		/*var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" class="crp"'+
				 ' title="click to request photo" onclick="requestPhoto(\''+pid+'\')"/>';*/
		var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" class="crp"'+
				 ' title="photo not provided"/>';
		elm.setStyle('background','url('+_url+') no-repeat center center').set('html',di);
		var asp = new Element('div',{	align:'center'}); 
		/*an = new Element('a',{href:"javascript:requestPhoto('"+pid+"')"}).set('html','request');
		asp.appendChild(an);*/
		elm.parentNode.appendChild(asp);
	}
	
}
function getPhotoApproval(elm,pid,sz,val,tot)
{
	
	vp = val - 1;	vn = val + 1; 
	pl = 'javascript:getPhotoFor($("'+elm.id+'"),"'+pid+'",'+sz+','+vp+','+tot+')';
	nl = 'javascript:getPhotoFor($("'+elm.id+'"),"'+pid+'",'+sz+','+vn+','+tot+')';
	if($('div_'+elm.id+pid)) elm.parentNode.removeChild($('div_'+elm.id+pid));
	if(tot > 0)
	{
		var _url = th_base+pid+'/'+sz+'/'+val+'/'+tot;
		var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" class="crp" onclick="popupPhoto(\''+
																										pid+'\')" STYLE="position:absolute;" />'+'<CENTER><b><FONT SIZE="-1" color="red">Approval Pending</FONT></b></CENTER>';
		elm.setStyle('background','url('+_url+') no-repeat center center').set('html',di);
		if(val == tot)		an = new Element('small',{'class':'nd'}).set('html','&nbsp;&nbsp;&nbsp;');
		else				an = new Element('a',{href:nl,'class':'nl'}).set('html','&nbsp;&nbsp;&nbsp;');
		
		if(val == 1)		ap = new Element('small',{'class':'pd'}).set('html','&nbsp;&nbsp;&nbsp;');	
		else				ap = new Element('a',{href:pl,'class':'pl'}).set('html','&nbsp;&nbsp;&nbsp;');	
		
		var asp = new Element('div',{	'class':'tc',id:'div_'+elm.id+pid,style:'width:'+sz+'px'});
			asp.appendChild(ap); 
			asp.appendChild(new Element('small').set('html','&nbsp;'+val+' of '+tot+'&nbsp;'));	
			asp.appendChild(an); 
		elm.parentNode.appendChild(asp); 
	}
	else 
	{	
		var _url = th_base+0+'/'+sz+'/'+val;
		/*var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" class="crp"'+
				 ' title="click to request photo" onclick="requestPhoto(\''+pid+'\')"/>';*/
		var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" class="crp"'+
				 ' title="photo not provided" STYLE="position:absolute; top:250px; left:20px; width:200px; height:25px" />'+'<CENTER><b><FONT SIZE="-1" color="red">Approval Pending</FONT></b></CENTER>';
		elm.setStyle('background','url('+_url+') no-repeat center center').set('html',di);
		var asp = new Element('div',{	align:'center'}); 
		/*an = new Element('a',{href:"javascript:requestPhoto('"+pid+"')"}).set('html','request');
		asp.appendChild(an);*/
		elm.parentNode.appendChild(asp);
	}
	
}

function getPhotoForAdmin(elm,pid,sz,val,tot)
{
	
	vp = val - 1;	vn = val + 1; 
	pl = 'javascript:getPhotoForAdmin($("'+elm.id+'"),"'+pid+'",'+sz+','+vp+','+tot+')';
	nl = 'javascript:getPhotoForAdmin($("'+elm.id+'"),"'+pid+'",'+sz+','+vn+','+tot+')';
	if($('div_'+elm.id+pid)) elm.parentNode.removeChild($('div_'+elm.id+pid));
	if(tot > 0)
	{
		var _url = up_base+pid+'/'+sz+'/'+val+'/'+tot;
		var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" class="crp" onclick="popupPhotoAdmin(\''+
																										pid+'\',\''+tot+'\')"/>';
		elm.setStyle('background','url('+_url+') no-repeat center center').set('html',di);
		if(val == tot)		an = new Element('small',{'class':'nd'}).set('html','&nbsp;&nbsp;&nbsp;');
		else				an = new Element('a',{href:nl,'class':'nl'}).set('html','&nbsp;&nbsp;&nbsp;');
		
		if(val == 1)		ap = new Element('small',{'class':'pd'}).set('html','&nbsp;&nbsp;&nbsp;');	
		else				ap = new Element('a',{href:pl,'class':'pl'}).set('html','&nbsp;&nbsp;&nbsp;');	
		
		var asp = new Element('div',{	'class':'tc',id:'div_'+elm.id+pid,style:'width:'+sz+'px'});
			asp.appendChild(ap); 
			asp.appendChild(new Element('small').set('html','&nbsp;'+val+' of '+tot+'&nbsp;'));	
			asp.appendChild(an); 
		elm.parentNode.appendChild(asp); 
	}
	else 
	{	
		var _url = th_base+0+'/'+sz+'/'+val;
		/*var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" class="crp"'+
				 ' title="click to request photo" onclick="requestPhoto(\''+pid+'\')"/>';*/
		var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" class="crp"'+
				 ' title="photo not provided" />';
		elm.setStyle('background','url('+_url+') no-repeat center center').set('html',di);
		var asp = new Element('div',{	align:'center'}); 
		/*an = new Element('a',{href:"javascript:requestPhoto('"+pid+"')"}).set('html','request');
		asp.appendChild(an);*/
		elm.parentNode.appendChild(asp);
	}
	
}


function getPhotoForDisplay(elm,pid,sz,val,tot)
{
	
	vp = val - 1;	vn = val + 1;
	if($('div_'+elm.id+pid)) elm.parentNode.removeChild($('div_'+elm.id+pid));
		
	var _url = ph_base+pid+'/'+sz+'/'+val;
	var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" />';
	elm.setStyle('background','url('+_url+') no-repeat center center').set('html',di);
	var asp = new Element('div',{	align:'center'}).set('html','&nbsp;');;
	/*an = new Element('a',{href:"javascript:requestPhoto('"+pid+"')"}).set('html','Request Photo');
	asp.appendChild(an);*/
	elm.parentNode.appendChild(asp);

}
function getPhotoForUserDisplay(elm,pid,sz,val,tot)
{
	
	vp = val - 1;	vn = val + 1;
	if($('div_'+elm.id+pid)) elm.parentNode.removeChild($('div_'+elm.id+pid));
		
	var _url = up_base+pid+'/'+sz+'/'+val;
	var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" />';
	elm.setStyle('background','url('+_url+') no-repeat center center').set('html',di);
	var asp = new Element('div',{	align:'center'}).set('html','&nbsp;');;
	/*an = new Element('a',{href:"javascript:requestPhoto('"+pid+"')"}).set('html','Request Photo');
	asp.appendChild(an);*/
	elm.parentNode.appendChild(asp);

}
/*user upload photo display*/
function getPhotoForUser(elm,pid,sz,val,tot)
{
	vp = val - 1;	vn = val + 1;
	if($('div_'+elm.id+pid)) elm.parentNode.removeChild($('div_'+elm.id+pid));
	var _url = up_base+pid+'/'+sz+'/'+val;
	//alert(_url);
	var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%"/>';
	elm.setStyle('background','url('+_url+') no-repeat center center').set('html',di);
	var asp = new Element('div',{	align:'center'}).set('html','&nbsp;');;
	/*an = new Element('a',{href:"javascript:requestPhoto('"+pid+"')"}).set('html','Request Photo');
	asp.appendChild(an);*/
	elm.parentNode.appendChild(asp);
}

function getPhotoThumb(elm,pid,sz,val,tot)
{
	
	vp = val - 1;	vn = val + 1;
	if($('div_'+elm.id+pid)) elm.parentNode.removeChild($('div_'+elm.id+pid));
		
	var _url = th_base+pid+'/'+sz+'/'+val;
	var di = '<img src="'+_base+'images/spacer.gif'+'" width="100%" height="100%" />';
	elm.setStyle('background','url('+_url+') no-repeat center center').set('html',di);
	var asp = new Element('div',{	align:'center'}).set('html','&nbsp;');;
	elm.parentNode.appendChild(asp);

}
function getPhotoShortList(elm,pid)
{
	bg = 'url('+_base+_index+'/profile/thumb/'+pid+'/35/1/1) no-repeat left top';
	elm.setStyle('background',bg);
}

function getBarDiagram(elm,tot,val,hgt)
{
	var st = 'height:'+hgt+'px; width:20px; margin-left:17px;margin-right:17px;float:left';
	var dv = new Element('div',{'style':st,'class':'bardgm' });
	var pc = (val / tot); 
		pc = hgt-parseInt(hgt * pc);
	st	= 'height:'+pc+'px;background-color:#fff';
	var ch = new Element('div',{'style':st }).set('html','&nbsp;');
	dv.appendChild(ch);
	elm.appendChild(dv);
}

function appendLink(el,val)
{
	el.href = el.href+'/'+val;
}

function getMessageFor(elm,mid,pid)
{
	
}
function deleteMessageBy(mid)
{

}
function getExpressInterestTab(elm,ePid)
{
	/*var cssClass = 'express_interest_tab';
	$('container').appendChild(new expressInterestTab({cssClass:cssClass,id:'exptab',width:400,height:400,ePid:ePid}));*/
	var cssClass = 'general_tab'; 
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'',
								   caption:'Express Interest',ajaxCall:'get_express_interest_options',
								   width:450,height:400,ePid:ePid}));
	//document.body.style.overflow ='hidden';
}
function gettooltip(elm,ePid)
{
		var cssClass = 'general_tab'; 
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'',
								   caption:'About Family',ajaxCall:'get_tool_tip_options',
								   width:450,height:400,ePid:ePid}));
}
function getaboutme(elm,ePid)
{
		var cssClass = 'general_tab'; 
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'',
								   caption:'About Me',ajaxCall:'get_about_me_options',
								   width:450,height:400,ePid:ePid}));
}
function getaboutpartner(elm,ePid)
{
		var cssClass = 'general_tab'; 
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'',
								   caption:'About Partner',ajaxCall:'get_about_partner_options',
								   width:450,height:400,ePid:ePid}));
}
function getaboutfamily(elm,ePid)
{
		var cssClass = 'general_tab'; 
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'',
								   caption:'About Family',ajaxCall:'get_about_family_options',
								   width:450,height:400,ePid:ePid}));
}
function showInfop(elm,msg)
{
	var cssClass = 'error_tab'; 
	$('container').appendChild(new infoTab({cssClass:cssClass,id:'infotab',msg:msg,width:400,height:200}));
	//document.body.style.overflow ='hidden';
}
function showInfo(elm,msg)
{
	var cssClass = 'information_box'; 
	$('container').appendChild(new infoLabel({cssClass:cssClass,id:'infotab',message:msg,width:400,height:200}));
	window.scrollTo(0,0);
	var intv = setInterval(	function()
							{ 	if($('infotab')) { $('infotab').style.display = 'none'; } clearInterval(intv);	},8000);
	//document.body.style.overflow ='hidden'; 
}
function showInfoTool(elm,msg,x,y)
{
	var cssClass = 'information_box'; 
	$('container').appendChild(new infoLabel({cssClass:cssClass,id:'infotab',message:msg,width:0,height:0}));
	window.scrollTo(x,y);
	var intv = setInterval(	function()
							{ 	if($('infotab')) { $('infotab').style.display = 'none'; } clearInterval(intv);	},0);
	//document.body.style.overflow ='hidden'; 
}
function showInfox(elm,msg)
{
	window.scrollTo(0,0);
	var cssClass = 'information_tab'; 
	$('container').appendChild(new infoTabx({cssClass:cssClass,id:'infotab',msg:msg,width:400,height:200}));
	var effect = new Fx.Tween($('infotab'), { property: 'height', duration: 700  });
	effect.start(60);
	
	var intv = setInterval(	function()
							{ 	if($('infotab')) {
								var efx = new Fx.Tween($('infotab'), { property: 'opacity', duration: 1000  });
								efx.start(0); } clearInterval(intv);	},8000);
	document.body.style.overflow ='visible';

}
function showError(elm,msg)
{
	/*var cssClass = 'error_tab'; 
	$('container').appendChild(new errorTab({cssClass:cssClass,id:'errortab',msg:msg,width:400,height:200}));
	//document.body.style.overflow ='hidden'; */
	showInfo(elm,msg);
}
function postInterest(form,ePid)
{
	for(i=0;i<form.rd_exp_int.length;i++)
	{
		chk = form.rd_exp_int[i].checked ? form.rd_exp_int[i] : false;
		if(chk) break; 
	}
	if(form.sms.checked == true) sms = 1; else sms=0;
	var msg = (chk.value == "C") ? form.txt_message.value : 'null';
	//alert(msg);
	showInfo(null,'Sending Message ...');
	_url =_base + _index +'/ajax_call/send_express_interest/'+chk.value+'/'+ePid+'/'+msg+'/'+sms+'/';
	//alert(_url);
	rq = new Request(
						  { 
							url:_url + Math.random(),
							method:'get',
							onSuccess: function(responseText)
							{
								if(responseText.indexOf('success')>=0)
									showInfo(chk,'Message Sucessfully Posted');
								else
									showError(chk,'Error Posting Message. Sorry for the inconvenience' );
							},
							onError:function()
							{
								showError(chk,"Request Timed Out!");
							}
						  }
					  );
	rq.send();
	
}
function postTooltip(form,ePid)
{	
	for(i=0;i<form.rd_exp_int.length;i++)
	{
		chk = form.rd_exp_int[i].checked ? form.rd_exp_int[i] : false;
		if(chk) break; 
	}
	var msg = (chk.value == "C") ? form.txt_message.value : 'null';
	_url =_base + _index +'/ajax_call/send_option/'+chk.value+'/'+ePid+'/'+msg+'/';
	//documnet.lifestyle.tct_aboutme.value = $('about_me_'+chk.value).innerHTML;
	//alert(_url);
	rq = new Request(
						  { 
							url:_url + Math.random(),
							method:'get',
							onSuccess: function(responseText)
							{
								if(responseText.indexOf('success')<=0)
								{
									document.lifestyle.about_family.value = document.frm_exp_int.rd_exp_int[i].value;
									showInfoTool('','',100,300);
								}else{
									//document.lifestyle.about_family.value = $('rd_exp_int').innerHTML;
									showInfo(chk,'Message Sucessfully Posted');
								}
							},
							onError:function()
							{
								showError(chk,"Request Timed Out!");
							}
						  }
					  );
	rq.send();
}
function postAboutme(form,ePid)
{	
	for(i=0;i<form.about_me.length;i++)
	{
		chk = form.about_me[i].checked ? form.about_me[i] : false;
		if(chk) break; 
	}
	var msg = (chk.value == "C") ? form.txt_message.value : 'null';
	_url =_base + _index +'/ajax_call/send_about_me/'+chk.value+'/'+ePid+'/'+msg+'/';
	//documnet.lifestyle.tct_aboutme.value = $('about_me_'+chk.value).innerHTML;
	//alert(_url);
	rq = new Request(
						  { 
							url:_url + Math.random(),
							method:'get',
							onSuccess: function(responseText)
							{
								if(responseText.indexOf('success')<=0)
								{
									document.lifestyle.about_me.value = document.frm_exp_int.about_me[i].value;
									showInfoTool('','',100,700);
								}else{
									//document.lifestyle.about_family.value = $('rd_exp_int').innerHTML;
									showInfo(chk,'Message Sucessfully Posted');
								}
							},
							onError:function()
							{
								showError(chk,"Request Timed Out!");
							}
						  }
					  );
	rq.send();
}
function postAboutfamily(form,ePid)
{	
	for(i=0;i<form.about_family.length;i++)
	{
		chk = form.about_family[i].checked ? form.about_family[i] : false;
		if(chk) break; 
	}
	var msg = (chk.value == "C") ? form.txt_message.value : 'null';
	_url =_base + _index +'/ajax_call/send_about_family/'+chk.value+'/'+ePid+'/'+msg+'/';
	//documnet.lifestyle.tct_aboutme.value = $('about_me_'+chk.value).innerHTML;
	//alert(_url);
	rq = new Request(
						  { 
							url:_url + Math.random(),
							method:'get',
							onSuccess: function(responseText)
							{
								if(responseText.indexOf('success')<=0)
								{
									document.partner.about_partner_family.value = document.frm_family.about_family[i].value;
									showInfoTool('','',100,900);
								}else{
									//document.lifestyle.about_family.value = $('rd_exp_int').innerHTML;
									showInfo(chk,'Message Sucessfully Posted');
								}
							},
							onError:function()
							{
								showError(chk,"Request Timed Out!");
							}
						  }
					  );
	rq.send();
}
function postAboutpartner(form,ePid)
{	
	for(i=0;i<form.about_partner.length;i++)
	{
		chk = form.about_partner[i].checked ? form.about_partner[i] : false;
		if(chk) break; 
	}
	var msg = (chk.value == "C") ? form.txt_message.value : 'null';
	_url =_base + _index +'/ajax_call/send_about_partner/'+chk.value+'/'+ePid+'/'+msg+'/';
	//documnet.lifestyle.tct_aboutme.value = $('about_me_'+chk.value).innerHTML;
	//alert(_url);
	rq = new Request(
						  { 
							url:_url + Math.random(),
							method:'get',
							onSuccess: function(responseText)
							{
								if(responseText.indexOf('success')<=0)
								{
									document.partner.about_partner.value = document.frm_partner.about_partner[i].value;
									showInfoTool('','',100,700);
								}else{
									//document.lifestyle.about_family.value = $('rd_exp_int').innerHTML;
									showInfo(chk,'Message Sucessfully Posted');
								}
							},
							onError:function()
							{
								showError(chk,"Request Timed Out!");
							}
						  }
					  );
	rq.send();
}

function reloadWindow()
{
	if(window.opener && !$('mx_dialog'))  window.location.reload();
}
function viewPhoneNumber(ePid)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'showContactNumber',
								   caption:'Contact Information',ajaxCall:'get_account_statistics_options',
								   width:400,height:150,ePid:ePid}));
	//document.body.style.overflow ='hidden';
	
}
function viewMyPhoneNumber(ePid)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'showContactNumber',
								   caption:'My Contact Information',ajaxCall:'get_my_contact_number',
								   width:400,height:150,ePid:ePid}));
	//document.body.style.overflow ='hidden';
	
}
function showMessage(elm,msg)
{
	//alert(msg);
		var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'',
								   caption:'My Contact Information',ajaxCall:'',
								   width:400,height:150,msg:msg}));
	elm.innerHTML = '+msg+';
	//document.body.style.overflow ='hidden';

}
function viewHoroscope(ePid)
{
	//url = _base+_index+'/profile/show_horoscope/'+ePid;
	url = _base+_index+'/profile/show_horoscope_view/'+ePid;
	var w = window.open(url,"horoscope"); 
	w.focus();
}
function forwardProfile(ePid)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'doForwardProfile',
								   caption:'Forward Profile',ajaxCall:'get_forward_profile_options',
								   width:650,height:400,ePid:ePid}));
	//document.body.style.overflow ='hidden';
}
function doForwardProfile(elm,ePid,_frm)
{
	_url = _base	+_index +'/ajax_call/do_forward_profile/'+ePid+'/'+_frm.recipient_name.value+'/'
										+_frm.recipient_email.value+'/'+_frm.message.value+'/'+Math.random();
	elm.innerHTML = 'Sending Profile...';
	rq = new Request(
						  { 
							url:_url,
							method:'get',
							onSuccess: function(responseText) 
							{
								elm.innerHTML = 'Profile successfully forwarded to '+_frm.recipient_email.value;
								//elm.appendChild(new Element('div',{'class':'cb'}).set('html',responseText));
								$('mx_dialog').removeChild(document.getElementById('generaltab'));
								showError(null,'Profile successfully forwarded to '+_frm.recipient_email.value);
							},
							onError:function()
							{
								showError(chk,"Request Timed Out!");
							}
						  }
					  );
	rq.send();
}
function viewAddress(ePid)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'showAddress',
								   caption:'Contact Address',ajaxCall:'get_account_statistics_options',
								   width:400,height:150,ePid:ePid}));
	//document.body.style.overflow ='hidden'; 
}
function viewMyAddress(ePid)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'showAddress',
								   caption:'My Contact Address',ajaxCall:'get_my_contact_address',
								   width:400,height:150,ePid:ePid}));
	//document.body.style.overflow ='hidden';
}
function showContactNumber(elm,ePid)
{
	rq = new Request(
						  { 
							url:_base + _index +'/ajax_call/show_contact_number/'+ePid+'/'+Math.random(),
							method:'get',
							onSuccess: function(responseText) 
							{
								elm.innerHTML = '';
								elm.appendChild(new Element('div',{'class':'cb w350'}).set('html',responseText));
							},
							onError:function()
							{
								showError(chk,"Request Timed Out!");
							}
						  }
					  );
	rq.send();
}
function replyCustomeMessage(mId)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'replyMessage',submitFn:'sendReplyMessage',
								   caption:'Reply Message',ajaxCall:'get_reply_message_options',
								   width:400,height:250,ePid:mId}));
	//document.body.style.overflow ='hidden';
}
function sendReplyMessage(form,mId)
{
	for(i=0;i<form.rd_exp_int.length;i++)
	{
		chk = form.rd_exp_int[i].checked ? form.rd_exp_int[i] : false;
		if(chk) break; 
	}
	var msg = (chk.value == "C") ? form.txt_message.value : 'null';
	act = _base + _index +'/communication/reply_custom_message/'+chk.value+'/'+mId+'/'+msg;
	form.action = act;
	form.submit();
}
function showAddress(elm,ePid)
{
	rq = new Request(
						  { 
							url:_base + _index +'/ajax_call/show_contact_address/'+ePid+'/'+Math.random(),
							method:'get',
							onSuccess: function(responseText) 
							{
								elm.innerHTML = '';
								elm.appendChild(new Element('div',{'class':'cb w350'}).set('html',responseText));
							},
							onError:function()
							{
								showError(chk,"Request Timed Out!");
							}
						  }
					  );
	rq.send();
}
function moveOptionTo(src,trg)
{
	
	if(src.options.selectedIndex >=0)
	{
		var sel = src.options[src.options.selectedIndex];	
		elm = new Element('option',{value:sel.value,text:sel.text});
		src.removeChild(sel);trg.appendChild(elm);
	}
	trg.focus();
}
function moveOptionadd(src,trg)
{
    var sel = src.options[src.options.selectedIndex];
    //alert(src.options.value);
    var iel = src.options.length;
    if(src.options.value == '0' )
	{
	clearOption(trg);
    elm = new Element('option',{value:0,text:'Any'});
    trg.appendChild(elm);
	//trg.options.add(new Element('option',{value:0,text:'Any'}));
	}
   	else if(trg.options.length == 0)
	{
		elm = new Element('option',{value:sel.value,text:sel.text});
		trg.appendChild(elm);
	}

   else if(trg.options[0].value == 0)
    {
		clearOption(trg);
        elm = new Element('option',{value:sel.value,text:sel.text});
		trg.appendChild(elm);
    }
   	else
	{
		elm = new Element('option',{value:sel.value,text:sel.text});
		//src.removeChild(sel);
        trg.appendChild(elm);
	
	
	trg.focus();
	}

}
function moveOptiondelete(src,trg)
{
	//if(trg.options[0].value ==0) return;
	if(src.options.value == 0)
	{
	clearOption(src);
	trg.options.add(new Element('option',{value:0,text:'Any'}));
	var sel = src.options[src.options.selectedIndex];	
	elm = new Element('option',{value:sel.value,text:sel.text});
	src.removeChild(sel);trg.appendChild(elm);

	//trg.options.add(new Element('option',{value:0,text:'Any'}));
	}else{
		var sel = src.options[src.options.selectedIndex];	
		elm = new Element('option',{value:sel.value,text:sel.text});
		src.removeChild(sel);
        //trg.appendChild(elm);
	}
}

function clearOption(oId)
{
	$(oId).options.length = 0;
}
function getAllOptionsOf(oId)
{
	obj = $(oId); var val = '';
	for(i=0; i < obj.options.length; i++)	val += obj.options[i].value;
	return val;
}
function validateForm(fId,_form)
{
	isError = false;
	switch(fId)
	{
		case 'PARTNER':
			//validate parntner form here
			_form.caste_index.value = getAllOptionsOf('caste_indexes');
			_form.education_level_index.value = getAllOptionsOf('education_index');
			_form.occupation_index.value = getAllOptionsOf('occupation_indexes');
			isZeroValue(_form.height_range_frm,0,'height range from');
			isZeroValue(_form.height_range_to,0,'height range to');
			isZeroValue(_form.religion,0,'religion');
			isZeroValue(_form.caste_index,0,'caste');
			isZeroValue(_form.education_level_index,0,'education');
			//isEmptyValue(_form.about_partner,'','about partner');
			//isEmptyValue(_form.about_partner_family,'','about partner family');
			isZeroValue(_form.citizenship,0,'Citizenship');
			//if(isZeroValue(_form.height_in_cms,0,'Height')) return false;
			if(isError == false) _form.submit();
		break;
		case 'MINIMAL':
		   	//alert(_form.value);
			//validate minimal form here
			isEmptyValue(_form.first_name,'','Name');
			isZeroValue(_form.need_horoscope_match,0,'Match');
			isZeroValue(_form.religion_code,0,'Religion');
			isZeroValue(_form.caste_code,0,'Caste');
			//isZeroValue(_form.caste_and_subcaste_code,'','Subcaste');
			isZeroValue(_form.height_in_cms,0,'Height');
			checkEmailExists(_form.email_id);			
			isEmptyValue(_form.email_id,'','Email-Id');
			validEmail(_form.email_id,_form.email_id.value);

			if($('education_level'))
			{
				isZeroValue(_form.education_level,0,'Education');
				isEmptyValue(_form.education_in_detail,'','Education details');
			}
			if($('occupation'))
			{
				isZeroValue(_form.occupation,0,'Occupation');
				isEmptyValue(_form.occupation_in_detail,'','Occupation details');
			}

//			isZeroValue(_form.native_country,0,'Native country');
//			isZeroValue(_form.native_state,0,'Native state');
//			isZeroValue(_form.native_place,0,'Native place');
			isZeroValue(_form.residing_country,0,'Residing country');
			isZeroValue(_form.residing_state,0,'Residing state');
			isZeroValue(_form.residing_place,0,'Residing place');
//			isZeroValue(_form.citizenship,0,'Citizenship');
//			isZeroValue(_form.residential_status,0,'Residential status');
//			isZeroValue(_form.mother_tongue,0,'Mother Tongue');
//			//validEmail(_form.alternate_email_id.value))return false;
//			isEmptyValue(_form.about_family,'','About family');
//			isEmptyValue(_form.father_name,'','Fathers name');
//			isEmptyValue(_form.mother_name,'','Mothers name');
			isEmptyValue(_form.address,'','Address');			
			isEmptyValue(_form.mobile_number,0,'Mobile number');
			isEmptyValue(_form.phone_number_ccode,'','Phone number code');
			isEmptyValue(_form.phone_number,0,'Phone number');
//			isEmptyValue(_form.about_me,'','About me');
			isEmptyValue(_form.password,'','Password');
			isZeroValue(_form.password,0,'Password');
			isSplChar(_form.password,_form.password.value);
			
			if(isError == false) _form.submit();
		break;

		case 'VALIDATE-LOGIN-VALUES':
			isEmptyValue(_form.login_id, '', 'Login ID');
			isEmptyValue(_form.password, '', 'Password');
			
			if(isError == false) 
				_form.submit();
		break;

		case 'MINIMAL-FOR-FORMREG':
		   	//alert(_form.value);
			//validate minimal form here
			isEmptyValue(_form.first_name,'','Name');
			isZeroValue(_form.need_horoscope_match,0,'Match');
			isZeroValue(_form.religion_code,0,'Religion');
			isZeroValue(_form.caste_code,0,'Caste');
			//isZeroValue(_form.caste_and_subcaste_code,'','Subcaste');
			isZeroValue(_form.height_in_cms,0,'Height');
			if($('education_level'))
				isZeroValue(_form.education_level,0,'Education');
			if($('occupation'))
				isZeroValue(_form.occupation,0,'Occupation');
			checkEmailExists(_form.email_id);			
			isEmptyValue(_form.email_id,'','Email-Id');
			validEmail(_form.email_id,_form.email_id.value);
			if($('education_in_detail'))
				isEmptyValue(_form.education_in_detail,'','Education details');
			if($('occupation_in_detail'))
				isEmptyValue(_form.occupation_in_detail,'','Occupation details');
//			isZeroValue(_form.native_country,0,'Native country');
//			isZeroValue(_form.native_state,0,'Native state');
//			isZeroValue(_form.native_place,0,'Native place');
			if($('residing_country'))
				isZeroValue(_form.residing_country,0,'Residing country');
			if($('residing_state'))
				isZeroValue(_form.residing_state,0,'Residing state');
			if($('residing_place'))
				isZeroValue(_form.residing_place,0,'Residing place');
//			isZeroValue(_form.citizenship,0,'Citizenship');
//			isZeroValue(_form.residential_status,0,'Residential status');
//			isZeroValue(_form.mother_tongue,0,'Mother Tongue');
//			//validEmail(_form.alternate_email_id.value))return false;
//			isEmptyValue(_form.about_family,'','About family');
//			isEmptyValue(_form.father_name,'','Fathers name');
//			isEmptyValue(_form.mother_name,'','Mothers name');
			isEmptyValue(_form.address,'','Address');			
			isEmptyValue(_form.mobile_number,0,'Mobile number');
			isEmptyValue(_form.phone_number_ccode,'','Phone number code');
			isEmptyValue(_form.phone_number,0,'Phone number');
//			isEmptyValue(_form.about_me,'','About me');
			isEmptyValue(_form.password,'','Password');
			isZeroValue(_form.password,0,'Password');
			isSplChar(_form.password,_form.password.value);
			
			if(isError == false) _form.submit();
		break;
		case 'LIFESTYLE':
			//alert(_form.value);
			//validate life style form here
			//isZeroValue(_form.citizenship,0,'Citizenship');
			isEmptyValue(_form.father_occupation,'','Fathers occupation');
			isEmptyValue(_form.mother_occupation,'','Mothers occupation');
			isEmptyValue(_form.about_me,'','About me');
			isEmptyValue(_form.about_family,'','About family');
			isZeroValue(_form.native_country,0,'Native country');
			isZeroValue(_form.citizenship,0,'Citizenship');

			if(_form.education_level)
			{
				isZeroValue(_form.education_level,0,'Education');
				isEmptyValue(_form.education_in_detail,'','Education details');
			}
			
			if(_form.occupation)
			{
				isZeroValue(_form.occupation,0,'Occupation');
				isEmptyValue(_form.occupation_in_detail,'','Occupation details');
			}
			
			//isZeroValue(_form.profile_created_by,0,'profile created by');
			if(isError == false) 
			{
				_form.submit();
				return true;
			}
		break;
		case 'FAMILY':
			//validate family details form here
			isEmptyValue(_form.father_name,'','Fathers name');
			isEmptyValue(_form.mother_name,'','Mothers name');
			isEmptyValue(_form.address,'','Address');
			isEmptyValue(_form.about_family,'','About family');
			if(isError == false) _form.submit();
		break;
		case 'HORO':
			//validate generate horo page details form here
			if(_form.time_zone.value=='')
			{
				showErrorMessage(_form.horo_place,'Birth place you selected is invalid !');
				return false;
			}			
			else  _form.submit();
		break;
		case 'HORO_TYPE':
			if(_form.horo_type.value=='')
			{
				showErrorMessage(_form.horo_type,'Choose type of horoscope !');
				return false;
			}			
			else  _form.submit();
		break;
		case 'UP_HORO':
			//validate upload horo page details form here
			if(_form.horo_file.value=='')
			{
				showErrorMessage(_form.horo_file,'Please choose a file to upload ');
				return false;
			}			
			else  _form.submit();
		break;
		case 'COMPOSE_HORO':
			//validate compose horo page details form here
			if(_form.hd_sun_pos_rasi.value=="0")
			{
				//showErrorMessage(_form.horo_file,'Please choose a file to upload ');
				alert('Please enter all details in your rasi chart to proceed further ');
				return false;
			}
			else if(_form.hd_moo_pos_rasi.value==0)
			{
				//showErrorMessage(_form.horo_file,'Please choose a file to upload ');
				alert('Please enter all details in your rasi chart to proceed further ');
				return false;
			}
			else if(_form.hd_mer_pos_rasi.value==0)
			{
				//showErrorMessage(_form.horo_file,'Please choose a file to upload ');
				alert('Please enter all details in your rasi chart to proceed further ');
				return false;
			}
			else if(_form.hd_ven_pos_rasi.value==0)
			{
				//showErrorMessage(_form.horo_file,'Please choose a file to upload ');
				alert('Please enter all details in your rasi chart to proceed further ');
				return false;
			}
			else if(_form.hd_mar_pos_rasi.value==0)
			{
				//showErrorMessage(_form.horo_file,'Please choose a file to upload ');
				alert('Please enter all details in your rasi chart to proceed further ');
				return false;
			}
			else if(_form.hd_jup_pos_rasi.value==0)
			{
				//showErrorMessage(_form.horo_file,'Please choose a file to upload ');
				alert('Please enter all details in your rasi chart to proceed further ');
				return false;
			}
			else if(_form.hd_sat_pos_rasi.value==0)
			{
				//showErrorMessage(_form.horo_file,'Please choose a file to upload ');
				alert('Please enter all details in your rasi chart to proceed further ');
				return false;
			}
			else if(_form.hd_rah_pos_rasi.value==0)
			{
				//showErrorMessage(_form.horo_file,'Please choose a file to upload ');
				alert('Please enter all details in your rasi chart to proceed further ');
				return false;
			}
			else if(_form.hd_ket_pos_rasi.value==0)
			{
				//showErrorMessage(_form.horo_file,'Please choose a file to upload ');
				alert('Please enter all details in your rasi chart to proceed further ');
				return false;
			}
			else if(_form.hd_maa_pos_rasi.value==0)
			{
				//showErrorMessage(_form.horo_file,'Please choose a file to upload ');
				alert('Please enter all details in your rasi chart to proceed further ');
				return false;
			}
			else if(_form.hd_lag_pos_rasi.value==0)
			{
				//showErrorMessage(_form.horo_file,'Please choose a file to upload ');
				alert('Please enter all details in your rasi chart to proceed further ');
				return false;
			}
			else  _form.submit();
		break;
		case 'CHANGE_PASSWORD':
			//validate change password form here
			isEmptyValue(_form.profile_id,'','Register number');
			isEmptyValue(_form.email_id,'','Email Id');
			validEmail(_form.email_id,_form.email_id.value);
			isEmptyValue(_form.old_password,'','Current password');
			isEmptyValue(_form.new_password,'','New password');
			isSplChar(_form.new_password,_form.new_password.value);
			isEmptyValue(_form.confirm_password,'','Confirm password');
			isPasswordequal(_form.confirm_password,_form.new_password.value,_form.confirm_password.value);
			if(isError == false) _form.submit();
		break;
		case 'REG_FULL_PROFILE':
			isEmptyValue(_form.first_name,'Enter your name','Name');
			isZeroValue(_form.marital_status,0,'Marital status');
			//isZeroValue(_form.children_living_status,0,'Children living status');
			isZeroValue(_form.religion_code,0,'Religion');
			isZeroValue(_form.caste_code,0,'Caste');
			isZeroValue(_form.height_in_cms,0,'Height');
			isZeroValue(_form.residing_country,0,'Residing country');
			isZeroValue(_form.residing_state_new,0,'Residing state');
			isZeroValue(_form.residing_place_new,0,'Residing place');
			isZeroValue(_form.residential_status,0,'Residential status');
			isEmptyValue(_form.address,'Address','Address');
			isEmptyValue(_form.email_id,'','Email-Id');
			checkEmailExists(_form.email_id);
			isEmptyValue(_form.email_id,'Enter your email-id','Email-Id');
			//validEmail(_form.email_id,_form.email_id.value);
			isZeroValue(_form.need_horoscope_match,0,'Horoscope match');
			isEmptyValue(_form.mobile_number,'Mobile number','Mobile number');
			isEmptyValue(_form.mobile_number,0,'Mobile number');
			//isEmptyValue(_form.phone_number_ccode,'Area code','Phone number code');
			isEmptyValue(_form.phone_number,'Land line number','Phone number');
			isEmptyValue(_form.phone_number,0,'Phone number');
			isEmptyValue(_form.password,'Your password','Password');
			isZeroValue(_form.password,0,'Password');
			isSplChar(_form.password,_form.password.value);
			if(isError == false) _form.submit();
		break;
	}
	return false;
}
function isPasswordequal(elm,nwpsw,conpsw)
{
	if(nwpsw != conpsw)
	{
		showErrorMessage(elm,'password mismatch');
		return false;
	}
	return true;
}
function goLogin(refUri)
{
	var uri = _base + _index + '/home/login/';
	var fm = new Element('form',{method:'post',action: uri});
	fm.appendChild(new Element('input',{	name:'http_referer',value:refUri,type:'hidden'	}));
	$('container').appendChild(fm);
	fm.submit();
}
function dockChat()
{
	if(isChatMaximized())
	{
		//anc.innerHTML = '...&nbsp;&nbsp;';
		minimizeChat();
	}
	else 
	{
		//anc.innerHTML = '_&nbsp;&nbsp;';
		maximizeChat();
	}
}
function isChatMaximized()
{
	if($('chatIframe').height > 0)	return true;
	else							return false;
}
function minimizeChat()
{
	$('chatIframe').height = 0;
}
function maximizeChat()
{
	$('chatIframe').height = 425;
}
/*function popupCheck(inviteName,toulv,status)
{
	$('chat_invite').innerHTML= '';
	if(status == 1)
	{
		dockChat();
		parent.onClickAccept(inviteName,toulv);
	}
	else
	{
		$('chat_invite').innerHTML= '';
		parent.onClickDeny(inviteName,toulv);
	}
	
}*/
function popupInvites(inviteName,toulv)
{
	//alert('hi');
	//$('chat_invite').innerHTML= 'test';
	window.focus();
	$('chat_invite').innerHTML= 
	'<span style="z-index:9090;" class="b ftblk pt12">Accept chat from '+inviteName+'?</span><div class="shim10 cb">&nbsp;</div>'+
	'<input type="button" class="flatbutton pt11" value="ACCEPT" onclick="popupCheck(\''+inviteName+'\','+toulv+',1)">'+
	'<input type="button" class="flatbutton pt11" value="DENY" onclick="popupCheck(\''+inviteName+'\','+toulv+',0)">'+
	'<div class="shim10 cb">&nbsp;</div>';
	
}
function adjustChat()
{
	if($('im_chat'))
	{
		$('im_chat').style.bottom = '0px';
		$('im_chat').style.right = '0px';
	}
}
function isIE6()
{
	var isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
	return isIE6;
}
function takeSearchName(elm)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new inputBox({cssClass:cssClass,id:'inputBox',onSubmit:'options.targetElement.form.submit()',
								   caption:'Search Save Name?',message:'Please Give a Name for your current search',
								   width:400,height:150,targetElement:elm,defaultText:'my search'}));
	//document.body.style.overflow ='hidden';
}
function takeSearchNameAdv(frm,elm)
{
	var cssClass = 'general_tab';
	caste_indexes(frm);
	place_indexes(frm);
	$('container').appendChild(new inputBox({cssClass:cssClass,id:'inputBox',onSubmit:'options.targetElement.form.submit()',
								   caption:'Search Save Name?',message:'Please Give a Name for your current search',
								   width:400,height:150,targetElement:elm,defaultText:'my search'}));
	//document.body.style.overflow ='hidden';
}
function acceptExpressInterest(mid)
{
	window.location.href= _base+_index+"/communication/accept_express_interest/"+mid;
	/*var req = ajaxRequest({ url:_base + _index +'/ajax_call/accept_express_interest/'+mid+'/'+Math.random(),
							callBack:'validateReturn(responseText);'});
	$('message_details').set('html','&nbsp;');*/
}
function declineExpressInterest(mid)
{
	window.location.href= _base+_index+"/communication/decline_express_interest/"+mid;
	/*var req = ajaxRequest({ url:_base + _index +'/ajax_call/decline_express_interest/'+mid+'/'+Math.random(),
							callBack:'validateReturn(responseText);'});
	$('message_details').set('html','&nbsp;'); */ 
}
function validateReturn(result)
{
	eval(result);
}
function saveHoroscope(pid,htype,isHoro,steps)
{
	//alert(pid);
	window.location.href= _base+_index+'/profile/update_horo_status/'+pid+'/'+htype+'/'+isHoro+'/'+steps;
}
function skipHoroscope(pid,htype,isHoro,steps)
{
	window.location.href= _base+_index+'/profile/update_horo_status/'+pid+'/'+htype+'/'+isHoro+'/'+steps;
}
function redirectHoroscope(val)
{
	if(val==1)
	window.location.href = _base+_index+'/register_profile/partner_preference_info';
	else
	window.location.href= _base+_index+'/edit_profile/';
}
function selectAllCheckBoxes(idprfx,cnt)
{
	for(i=1;i<=cnt;i++)
	$(idprfx+i).checked = !$(idprfx+i).checked;
}
function popupPrintView(ePid)
{
	removeElement('mx_dialog');
	url = _base+_index+'/profile/show_print_view/'+ePid;
	var w = window.open(url,"print_view"); 
	w.focus();	
}
function popupFullPrintView(ePid)
{
	url = _base+_index+'/profile/show_full_print_view/'+ePid;
	var w = window.open(url,"full_print_view"); 
	w.focus();
}
function isemptysearch(id,type,minlen)
{
	var str = $(id).value.replace(/^\s+|\s+$/g, '');
	if(str.length < minlen) 
	{
		if(type == 'name')		alert('Please enter a valid Name');
		else if(type == 'id')	alert('Please enter a valid ID');
		return false;
	}
	return true;
}
function isEmptyValue(elm,validation,field)
{
	if($(elm.name+'_err_panel')) elm.parentNode.removeChild($(elm.name+'_err_panel'));
	value = trim(elm.value);
	if(value == validation)
	{
		showErrorMessage(elm,field+' cannot be empty'); 
		//elm.focus();
		return true;		
	}
	else return false;
}
function isZeroValue(elm,validation,field)
{
	if($(elm.name+'_err_panel')) elm.parentNode.removeChild($(elm.name+'_err_panel'));
	value = trim(elm.value);
	if(value == validation)
	{
		showErrorMessage(elm,'You must choose a value for '+field);
		//elm.focus(); 
		return true;		
	}
	else return false; 
}
function validateMaritalStatus(_form,elm)
{
	if(parseInt(elm.value) < 3 ) 
	{
		disableOptions(_form,'children_living_status',true);
		_form.no_of_children.disabled = true;
	}
	else
	{
		disableOptions(_form,'children_living_status',false);
		_form.no_of_children.disabled = false;
	}
}
function disableOptions(_form,id,dis)
{
	for(i=0;i<_form.elements[id].length;i++) 
	_form.elements[id][i].disabled = dis;
}
function evenieldKey(evt)
{
	 var charCode = (evt.which) ? evt.which : event.keyCode;
	 if(charCode == 44 ) return true;
	 else if (charCode > 31 && (charCode < 48 || charCode > 57) )
		return false;
	 return true;
}
function validEmail(elm,email) 
{
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = email;
   if(reg.test(address) == false) {
	   showErrorMessage(elm,'"'+email+'" is an invalid email id');
	   return false;
   }
   return true;
}
function popupPhoto(pid)
{
	var params = 	"height=650,width=600,toolbar=no,menubar=no,scrollbars=no,resizable=no"	+
					",location=no,status=no,alwaysRaised=yes,directories=no,titlebar=no";
	var wnd = window.open(_base+_index+"/profile/photoes/"+pid+"/","popup_photo",params);
}
function popupPhotoAdmin(pid,tot)
{
	var params = 	"height=600,width=600,toolbar=no,menubar=no,scrollbars=no,resizable=no"	+
					",location=no,status=no,alwaysRaised=yes,directories=no,titlebar=no";
	var wnd = window.open(_base+_index+"/admin/remove_photo/"+pid+"/"+tot+"/","popup_photo",params);
}
function uploadPhoto(ePid)
{
	var params = 	"height=700,width=600,toolbar=no,menubar=no,scrollbars=no,resizable=no"	+
					",location=no,status=no,alwaysRaised=yes,directories=no,titlebar=no";
	//var wnd = window.open(_base+_index+"/edit_profile/upload_photo_popup/"+ePid+"/"+"0"+"/"+"1","popup_photo",params);
	var wnd = window.open(_base+_index+"/ajax_call/upload_photo/"+ePid+"/"+"0"+"/"+"1","popup_photo",params);
	/*
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'showPhoto',
								   caption:'Upload Photo',ajaxCall:'upload_photo',
								   width:950,height:200,ePid:ePid}));
	$('generaltab').setStyle("top","100px");
	window.scrollTo(0,0);*/
}
function doHoroMatch(ePid)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'performMatching',
								   caption:'Horoscope Matching',ajaxCall:'get_porutham_statistics_options',
								   width:400,height:150,ePid:ePid}));
	//document.body.style.overflow ='hidden';
}

function do_FP_HoroMatch(eip, eFullName, ePidPrefix)
{
	ePid = eip + '|' + eFullName + '|' + ePidPrefix;
	
	var cssClass = 'new_general_exp_int__tab';
	$('container').appendChild(new generalNewPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'performMatching',
								   caption:'Horoscope Matching',ajaxCall:'get_porutham_statistics_options',
								   width:400,height:150,ePid:ePid}));
}

function performMatching(elm,ePid)
{
	removeElement('mx_dialog');
	url = _base+_index+'/profile/prepare_porutham_report/'+ePid;
	var w = window.open(url,"print_view"); 
	w.focus();
}
function doPayment(rqType,pId,ePid)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'performPayment',
								   caption:'Payment Details Plan',ajaxCall:'get_payment_options/'+rqType+'/'+pId,
								   width:400,height:250,ePid:ePid}));
}
function doUserPayment(rqType,pId,ePid)
{
	
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'performUserPayment/',
								   caption:'Payment Details Plan',ajaxCall:'get_user_payment/'+rqType+'/'+pId,
								   width:400,height:250,ePid:ePid}));
}

function doPaymentMgz(rqType,amt,ePid)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'performPaymentMagazine',
								   caption:'Payment Magazine Advertisement',ajaxCall:'get_payment_magazine/'+rqType+'/'+amt,
								   width:400,height:250,ePid:ePid}));
}
function deleteProfile(ePid)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'performDelete',
								   caption:'Delete Profile',ajaxCall:'get_delete_profile_options',
								   width:500,height:250,ePid:ePid}));
}
function deleteProfileMail(ePid)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'performDelete',
								   caption:'Delete Profile',ajaxCall:'delete_profile_options_mail',
								   width:500,height:250,ePid:ePid}));
}
function performDelete(ePid,form)
{
	$('error_msg_reason').set('html','&nbsp;'); $('error_msg_comment').set('html','&nbsp;');
	if(form.reason.selectedIndex == 0)
	{
		$('error_msg_reason').set('html','you must select a reason from the list'); return false;
	}
	if(form.reason.selectedIndex == (form.reason.options.length -1))
	{
		if( trim(form.comment.value) == '')
		{
			$('error_msg_comment').set('html','you must give a reason in the text box below'); return false;
		}
	}
	form.submit();
}
function performPayment(form,ptype,pid)
{
	if(!validatePaymentForms(form,ptype)) return;
	form.action = _base+_index+'/plans/perform_payment/';
	form.submit();
}
function performUserPayment(form,ptype,pid,ePid)
{
	if(!validatePaymentForms(form,ptype)) return;
	form.action = _base+_index+'/admin_plan/perform_payment/';
	form.submit();
}

function performPaymentMagazine(form,ptype,pid)
{
	if(!validatePaymentForms(form,ptype)) return;
	form.action = _base+_index+'/plans/perform_payment_magazine/';
	form.submit();
}
function removeHoro(ePid)
{
	url = _base+_index+'/register_profile/remove_horoscope/'+ePid;
	window.location.href = url;
}

function validatePaymentForms(form,ptype)
{
	isError = false;
	switch(ptype)
	{
		case 'franchisee': 
			isZeroValue(form.state,0,'State');
			isZeroValue(form.city,0,'City');
			isZeroValue(form.franchisee,0,'Franchisee');
		break;
		case 'cheque': 
			isEmptyValue(form.cq_drawee,'','Drawee');
			isEmptyValue(form.cq_no,'','Cheque Number');
			isEmptyValue(form.cq_bank_name,'','Bank Name');
			isEmptyValue(form.cq_place_of_issue,'','Place of issue');
			isEmptyValue(form.chq_date,'','Cheque Date');			
		break;
		case 'demand_draft': 
			isEmptyValue(form.dd_drawee,'','Drawee');
			isEmptyValue(form.dd_no,'','DD Number');
			isEmptyValue(form.dd_bank_name,'','Bank Name');
			isEmptyValue(form.dd_place_of_issue,'','Place of issue');
			isEmptyValue(form.dd_date,'','DD Date');			
		break;
		case 'money_order':
			isEmptyValue(form.name,'','Name');
			isEmptyValue(form.mo_no,'','MO Number');
			isEmptyValue(form.mo_place_of_issue,'','Place of issue');
			isEmptyValue(form.mo_date,'','MO Date');
		break;
		case 'GAD':
			isZeroValue(form.pay_type,0,'Payment Type');
			isZeroValue(form.pay_amount,0,'Payment Amount');
		break;
	}
	if(isError) return false;
	else return true;
}
function requestHoroscope(ePid)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'doRequestHoroscope',
								   caption:'Request Horoscope',ajaxCall:'get_horo_request_options',
								   width:400,height:250,ePid:ePid}));
}

function requestFPHoroscope(eip, eFullName, ePidPrefix, eGender)
{
	ePid = eip + '|' + eFullName + '|' + ePidPrefix + '|' + eGender;

	var cssClass = 'new_general_exp_int__tab';
	$('container').appendChild(new generalNewPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'doRequestHoroscope',
								   caption:'Request Horoscope',ajaxCall:'get_FP_horo_request_options',
								   width:400,height:250,ePid:ePid}));
}

function doRequestHoroscope(ePid)
{
	removeElement('mx_dialog');
	
	showInfo(null,"Sending Horoscope Request...");
	
	rq = new Request(
					  { 
						url:_base + _index +'/ajax_call/send_horo_request/'+ePid+'/'+Math.random(),
						method:'get',
						onSuccess: function(responseText) 
						{
							showInfo(null,"Your horoscope request is successfully sent.");
						},
						onError:function()
						{
							showError(chk,"Request Timed Out!"); 
						}
					  }
				  );
	rq.send();
}

function doRequestHoroscopeandPromptUpload(ePid)
{
	removeElement('mx_dialog');
	
	showInfo(null,"Sending Horoscope Request...");
	
	rq = new Request(
					  { 
						url:_base + _index +'/ajax_call/send_horo_request/'+ePid+'/'+Math.random(),
						method:'get',
						onSuccess: function(responseText) 
						{
							showInfo(null,"Your horoscope request is successfully sent.");

							MessageCaption = 'Upload and Request Horoscope';
							
							var cssClass = 'new_general_exp_int__tab';
							$('container').appendChild(new generalNewPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'',
								   caption:MessageCaption,ajaxCall:'get_PromptFor_Upload_Horoscope',
								   width:450,height:400,ePid:ePid}));
						},
						onError:function()
						{
							showError(chk,"Request Timed Out!"); 
						}
					  }
				  );
	rq.send();
}


function requestPhoto(ePid)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'doRequestPhoto',
								   caption:'Request Photograph',ajaxCall:'get_photo_request_options',
								   width:400,height:250,ePid:ePid}));
}
function doRequestPhoto(ePid)
{
		removeElement('mx_dialog');
		rq = new Request(
						  { 
							url:_base + _index +'/ajax_call/send_photo_request/'+ePid+'/'+Math.random(),
							method:'get',
							onSuccess: function(responseText) 
							{
								showInfo(null,"Your photo request is successfully sent.");
							},
							onError:function()
							{
								showError(chk,"Request Timed Out!");
							}
						  }
					  );
	rq.send();

}
function loadChat()
{
	var url =_base+_index+'/chat/index/'+Math.random();
	rq = new Request(
						  { 
							url:url,
							method:'get',
							onSuccess: function(responseText) 
							{
								elm = $('ichat');
								elm.set('html',responseText);
							},
							onError:function()
							{
								showError(chk,"Request Timed Out!");
							}
						  }
					  );
	rq.send(); 
}

function showErrorMessage(elm,message)
{
	isError = true;
	var err = new Element('div',{'class':'cb pt11 ftred',id:elm.name+'_err_panel'});
	if($(elm.name+'_err_panel')) elm.parentNode.removeChild($(elm.name+'_err_panel'));
	err.set('html',message);
	elm.parentNode.appendChild(err);
	if($(elm)) 
	{
		if($(elm).style.display != 'none')
			elm.focus();
	}
}
function checkEmailExists(elm)
{
	if(elm.value.length == 0) return;
	rq = new Request(
						  { 
							url:_base + _index +'/ajax_call/check_email_exists/'+elm.value+'/'+Math.random(),
							method:'get',
							onSuccess: function(responseText) 
							{
								if(responseText.indexOf('true') >= 0)
								{
									showErrorMessage(elm,'Email Already Registered!');
									elm.value = "";
									//elm.focus();
									if(navigator.appName == "Microsoft Internet Explorer")
									window.document.execCommand('Stop');
									else	window.stop();
									return true;
								}
								else
								{	if($(elm.name+'_err_panel')) $(elm.name+'_err_panel').set('html','&nbsp;');	return false;}
							},
							onError:function()
							{
								showError(chk,"Request Timed Out!");
							}
						  }
					  );
	rq.send();
}
function disableRightClick()
{
	document.oncontextmenu=new Function("return false");/*
	document.onmousedown=function(e){catchClick(e)};	
	if (document.layers) 
	{
		document.captureEvents(Event.MOUSEDOWN);
	}
	*/
}
function isNumberKey(evt)
{
	var charCode = (evt) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57))
	return false;
	
	return true;
}
function stopRKey(evt) 
{ 
  var evt = (evt) ? evt : ((event) ? event : null); 
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); 
  if ((evt.keyCode == 13) && (node.type!="button"))  {return false;} 
}
function starMatch(bt)
{
	var x = window.open('');
	x.location = _base+_index+'/star_matching/domatch/'+bt.form.boys_star.value+'/'+bt.form.girls_star.value+'/'+
				 bt.form.report_language.value;
}
function catchClick(e) 
{
	if (document.all ) 
	{
		//alert(event.button);
		if (event.button == 2) 
		{	//navigator.appName == 'Netscape' &&
			return false;
		}
		return;
	}
	if (document.layers) 
	{ alert(e.which);
		if (e.which == 3) 
		{
			return false;
		}
		return ;
	}
	if(e.button)
	{
		alert("Right Click is disabled in this page");		
		return false;

	}
}

function blinkMessage()
{
	//spe=500;
	//na=document.all.tags("blink");
	//swi=1;
	if (swi == 1) 
	{
		sho='visible';
		swi=0;
		col = 'red';
	}
	else 
	{
		sho='hidden';
		swi=1;
		col = 'blue';
	}		
	for(i=0;i<na.length;i++) 
	{
		na[i].style.color=col;
		//na[i].style.visibility=sho;
	}		
	setTimeout("blinkMessage()", spe);
}
function popupHoroGenerate()
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'',
								   caption:'Generate Horoscope',ajaxCall:'get_generate_horoscope_popup',
								   width:650,height:550,ePid:''}));	
}
function editProfile()
{
	window.location.href = _base+_index+'/edit_profile'; 
}
function getStarForRasiold(_iRasi,trg)
{
	var _opt = null;
	trg = document.getElementById(trg);
	switch(parseInt(_iRasi))
	{
		case 1	: 
			_opt="<option value='1'>Aswathy</option><option value='2'>Bharani</option><option value='3'>Kartika</option>";
		break;
		case 2	: 
			_opt="<option value='4'>Karthika</option><option value='5'>Rohini</option><option value='6'>Makayiram</option>";
		break;
		case 3	: 
		   _opt="<option value='7'>Makayiram</option><option value='8'>Thiruvathira</option><option value='9'>Punartham</option>";
		break;
		case 4	: 
			_opt="<option value='10'>Punartham</option><option value='11'>Pooyam</option><option value='12'>Ayilyam</option>";
		break;
		case 5	: 
			_opt="<option value='13'>Makam</option><option value='14'>Pooram</option><option value='15'>Uthram</option>";
		break;
		case 6	: 
			_opt="<option value='16'>Uthram</option><option value='17'>Atham</option><option value='18'>Chithira</option>";
		break;
		case 7	: 
			_opt="<option value='19'>Chithira</option><option value='20'>Chothi</option><option value='21'>Vishakham</option>";
		break;
		case 8	: 
			_opt="<option value='22'>Vishakham</option><option value='23'>Anizham</option><option value='24'>Thrikketta</option>";
		break;
		case 9	: 
			_opt="<option value='25'>Moolam</option><option value='26'>Pooradam</option><option value='27'>Uthradam</option>";
		break;
		case 10	: 
			_opt="<option value='28'>Uthradam</option><option value='29'>Thiruvonam</option><option value='30'>Avittom</option>";
		break;
		case 11	: 
			_opt="<option value='31'>Avittom</option><option value='32'>Chathayam</option>"+
			"<option value='33'>Pooruruttathi</option>";
		break;
		case 12	: 
			_opt="<option value='34'>Pooruruttathi</option><option value='35'>Uthruttathi</option>"+
			"<option value='36'>Revathi</option>";
		break;
		default:
		    _opt="<option value='1'>Aswathy</option><option value='2'>Bharani</option><option value='31'>Kartika</option>";
		break;
	}
	return _opt;
}
function getStarForRasi(_iRasi,trg)
{
	var _opt = null;
	var trg = document.getElementById(trg);	
	trg.options.length = 0;
	switch(parseInt(_iRasi))
	{
		case 1	: 
			{
				trg.options[trg.length] = new Option("Aswathy", "1");
				trg.options[trg.length] = new Option("Bharani", "2");
				trg.options[trg.length] = new Option("Kartika", "3");
				break;
			}
		case 2	: 
			{
				trg.options[trg.length] = new Option("Karthika"	, "4");
				trg.options[trg.length] = new Option("Rohini"	, "5");
				trg.options[trg.length] = new Option("Makayiram", "6");
				break;
			}
		case 3	: 
			{
				trg.options[trg.length] = new Option("Makayiram"	, "7");
				trg.options[trg.length] = new Option("Thiruvathira"	, "8");
				trg.options[trg.length] = new Option("Punartham"	, "9");
				break;
			}
		case 4	: 
			{
				trg.options[trg.length] = new Option("Punartham", "10");
				trg.options[trg.length] = new Option("Pooyam"	, "11");
				trg.options[trg.length] = new Option("Ayilyam"	, "12");
				break;
			}
		case 5	: 
			{
				trg.options[trg.length] = new Option("Makam" , "13");
				trg.options[trg.length] = new Option("Pooram", "14");
				trg.options[trg.length] = new Option("Uthram", "15");
				break;
			}
		case 6	: 
			{
				trg.options[trg.length] = new Option("Uthram"  , "16");
				trg.options[trg.length] = new Option("Atham"   , "17");
				trg.options[trg.length] = new Option("Chithira", "18");
				break;
			}
		case 7	: 
			{
				trg.options[trg.length] = new Option("Chithira"	, "19");
				trg.options[trg.length] = new Option("Chothi"	, "20");
				trg.options[trg.length] = new Option("Vishakham", "21");
				break;
			}
		case 8	: 
			{
				trg.options[trg.length] = new Option("Vishakham" , "22");
				trg.options[trg.length] = new Option("Anizham"	 , "23");
				trg.options[trg.length] = new Option("Thrikketta", "24");
				break;
			}
		case 9	: 
			{
				trg.options[trg.length] = new Option("Moolam"	, "25");
				trg.options[trg.length] = new Option("Pooradam"	, "26");
				trg.options[trg.length] = new Option("Uthradam" , "27");
				break;
			}
		case 10	: 
			{
				trg.options[trg.length] = new Option("Uthradam"	 , "28");
				trg.options[trg.length] = new Option("Thiruvonam", "29");
				trg.options[trg.length] = new Option("Avittom"	 , "30");
				break;
			}
		case 11	: 
			{
				trg.options[trg.length] = new Option("Avittom"		, "31");
				trg.options[trg.length] = new Option("Chathayam"	, "32");
				trg.options[trg.length] = new Option("Pooruruttathi", "33");
				break;
			}
		case 12	: 
			{
				trg.options[trg.length] = new Option("Pooruruttathi", "34");
				trg.options[trg.length] = new Option("Uthruttathi"	, "35");
				trg.options[trg.length] = new Option("Revathi"		, "36");
				break;
			}
		default:
			{
				trg.options[trg.length] = new Option("Aswathy", "1");
				trg.options[trg.length] = new Option("Bharani", "2");
				trg.options[trg.length] = new Option("Kartika", "3");
				break;
			}
	}
}	
function submtStarMatch(form) 
{
	var fr = form;
	var w = window.open(fr.action+"/"+fr.boys_star.value+"/"+fr.girls_star.value,"",
						"width=500,height=425,location=no,resizable=no");
	w.moveTo((screen.width/2)-300,(screen.height/2)-275);
	w.focus();
}
function openInNewWindowpopup(actionPage) 
{
	var newWindow = window.open(this.getAttribute('href'), '_blank');
	newWindow.focus();
	return false;
}
function openInNewWindow(formId) 
{
	document.frmstarmatch.action = document.getElementById(formId).getAttribute("action");
	document.frmstarmatch.target = "_blank";
	document.frmstarmatch.method = document.getElementById(formId).getAttribute("method");
	document.frmstarmatch.submit();
}
function netGroupList()
{
	window.location.href=_base+_index+'/home/netgroup_list'; 
}
function isSplChar(elm,str)
{
	var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?~_"; 
	for (var i = 0; i < str.length; i++) 
	{
		if (iChars.indexOf(str.charAt(i)) != -1) 
		{
			showErrorMessage(elm,"Special characters like ( / ; &quot; ' * ) etc are not allowed in your password"); 
			return false;
		}
		return true;
	}
}
function addMultiSearches(frm)
{
caste_indexes(frm);
place_indexes(frm);
occu_indexes(frm);
//myfunction4();

}
function advancedSearchsubmit(frm)
{
	caste_indexes(frm);
	place_indexes(frm);
	//occu_indexes(frm);
	document.adsrch.action = _base+_index+"/search_profile/advanced_search"; 
	document.adsrch.submit(); 
}
function caste_indexes(frm)
{
	  var val = '';
	  for(i = 0;i < frm.caste_indexes.options.length; i++)
	  {
		  val = val + ',' + frm.caste_indexes.options[i].value;
	  }
	  frm.caste_index.value = val;
}
function place_indexes(frm)
{
	  var val = '';
	  for(i = 0;i < frm.place_indexes.options.length; i++)
	  {
		  val = val + ',' + frm.place_indexes.options[i].value;
	  }
	  frm.place_index.value = val;
}
function occu_indexes(frm)
{
	  var val = '';
	  for(i = 0;i < frm.occu_indexes.options.length; i++)
	  {
		  val = val + ',' + frm.occu_indexes.options[i].value;
	  }
	  frm.occu_index.value = val;

}
/* added anitha 4 compose horoscope */
function getPlanetCells(_rasi)
{
	_html =	'<div>';
	_html+=	'	<div id="'+_rasi+'_sun" class="none"></div>';
	_html+=	'	<div id="'+_rasi+'_moon" class="none"></div>';
	_html+=	'	<div id="'+_rasi+'_mercury" class="none"></div>';
	_html+=	'</div>                                  '; 
	_html+=	'<div>                                   ';   
	_html+=	'	<div id="'+_rasi+'_venus" class="none"></div>';
	_html+=	'	<div id="planet"></div>             ';
	_html+=	'	<div id="'+_rasi+'_mars" class="none"></div>';
	_html+=	'</div>                                  '; 
	_html+=	'<div>                                   '; 
	_html+=	'	<div id="'+_rasi+'_jupiter" class="none"></div>';
	_html+=	'	<div id="'+_rasi+'_ketu" class="none"></div>   ';
	_html+=	'	<div id="'+_rasi+'_saturn" class="none"></div>';
	_html+=	'</div>                                  '; 
	_html+=	'<div>                                   '; 
	_html+=	'	<div id="'+_rasi+'_rahu" class="none"></div>';
	_html+=	'	<div id="'+_rasi+'_lagnam" class="none"></div>';
	_html+=	'	<div id="'+_rasi+'_maandi" class="none"></div>';
	_html+=	'</div>';

	return _html;
}

function fillChartCells(id)
{
	val = $('#'+id+' #medam_sun').get(0) ? $('#'+id+' #medam_sun').get(0):false;
	if(!val)
	{
		chartCells = $('#'+id).get(0).childNodes;
		for(i=0 ; i < chartCells.length ; i++)
		{
			rowCells = chartCells[i].childNodes;
			for(j=0 ; j < rowCells.length ; j++)
			{
				_html = getPlanetCells(rowCells[j].id);
				if(rowCells[j].id != 'shimm') rowCells[j].innerHTML = _html;
			}
		}
	}
}
function getRasiName(id)
{
	_rasi = '';
	switch(id)
	{
		case 1 : _rasi = 'medam'; 			break;
		case 2 : _rasi = 'edavam';			break;
		case 3 : _rasi = 'mithunam'; 		break;
		case 4 : _rasi = 'karkitakam'; 		break;
		case 5 : _rasi = 'chingam'; 		break;
		case 6 : _rasi = 'kanni'; 			break;
		case 7 : _rasi = 'thulam'; 			break;
		case 8 : _rasi = 'vrishchikam'; 	break;
		case 9 : _rasi = 'dhanu'; 			break;
		case 10: _rasi = 'makaram'; 		break;
		case 11: _rasi = 'kumbham'; 		break;
		case 12: _rasi = 'meenam';	 		break;
	}
	return _rasi;
}

function setPlanetPos(parentId,planetName,toRasi)
{
	removePlanet(parentId,planetName);
	addPlanetAt(parentId,planetName,toRasi);
}
function removePlanet(parentId,planetName)
{
		ctrlId = '#'+'hd_'+planetName.substr(0,3)+'_pos'+'_'+parentId.substr(0,4);
		ctrlId = ctrlId.toLowerCase();
		_rasiid  = parseInt($(ctrlId).get(0).value);
		if(_rasiid > 0)
		{
			_removeCell = $('#'+parentId+' #'+getRasiName(_rasiid)+'_'+planetName.toLowerCase()).get(0);
			_removeCell.className = 'none';
		}
}
function addPlanetAt(parentId,planetName,toRasi)
{
	if(parseInt(toRasi) > 0)
	{
		_rid = parseInt(toRasi);
		_cId = '#'+parentId+' #'+getRasiName(_rid)+'_'+planetName.toLowerCase();
		_rasiColumn = $(_cId).get(0);
		planet_field = planetName.toLowerCase();
		_rasiColumn.className = planet_field;
		_cId = '#'+'hd_'+planet_field.substr(0,3)+'_pos'+'_'+parentId.substr(0,4);
		$(_cId.toLowerCase()).get(0).value = _rid;
	}
}
function showTab(tabNo,tabTotal,tabName)
{
	var cur_tab_content = tabName+"_content_"+tabNo;
	document.getElementById(cur_tab_content).style.display=(document.getElementById(cur_tab_content).style.display=="none")? "block" : "none";
	for(i=1;i<=tabTotal;i++)
		{
		if(i != tabNo)
			{
			var oth_tab_content = tabName+"_content_"+i;
			document.getElementById(oth_tab_content).style.display="none";
			}
		}
}

function setRahuKetuPos(parentId,planetName,toRasi)
{
	removePlanet(parentId,'RAHU');
	removePlanet(parentId,'KETU');
	setPlanetPos(parentId,planetName,toRasi);
	if(planetName == 'RAHU')
	{ 
		addPlanetAt(parentId,'KETU',getRahuKetuPos(toRasi)); 
	}
	else 
	{ 
		addPlanetAt(parentId,'RAHU',getRahuKetuPos(toRasi));  
	}

}

function getRahuKetuPos(_pos)
{
	_pos = parseInt(_pos);
	_ret = _pos + 6;
	if(_ret > 12) _ret = _ret-12;
	return _ret;
}

function getStarForRasi(_iRasi)
{
	var _opt = null;
	switch(parseInt(_iRasi))
	{
		case 1	: 
			_opt="<option value='1'>Aswathy</option><option value='2'>Bharani</option><option value='3'>Kartika</option>";
		break;
		case 2	: 
			_opt="<option value='4'>Karthika</option><option value='5'>Rohini</option><option value='6'>Makayiram</option>";
		break;
		case 3	: 
			_opt="<option value='7'>Makayiram</option><option value='8'>Thiruvathira</option><option value='9'>Punartham</option>";
		break;
		case 4	: 
			_opt="<option value='10'>Punartham</option><option value='11'>Pooyam</option><option value='12'>Ayilyam</option>";
		break;
		case 5	: 
			_opt="<option value='13'>Makam</option><option value='14'>Pooram</option><option value='15'>Uthram</option>";
		break;
		case 6	: 
			_opt="<option value='16'>Uthram</option><option value='17'>Atham</option><option value='18'>Chithira</option>";
		break;
		case 7	: 
			_opt="<option value='19'>Chithira</option><option value='20'>Chothi</option><option value='21'>Vishakham</option>";
		break;
		case 8	: 
			_opt="<option value='22'>Vishakham</option><option value='23'>Anizham</option><option value='24'>Thrikketta</option>";
		break;
		case 9	: 
			_opt="<option value='25'>Moolam</option><option value='26'>Pooradam</option><option value='27'>Uthradam</option>";
		break;
		case 10	: 
			_opt="<option value='28'>Uthradam</option><option value='29'>Thiruvonam</option><option value='30'>Avittom</option>";
		break;
		case 11	: 
			_opt="<option value='31'>Avittom</option><option value='32'>Chathayam</option>"+
			"<option value='33'>Pooruruttathi</option>";
		break;
		case 12	: 
			_opt="<option value='34'>Pooruruttathi</option><option value='35'>Uthruttathi</option>"+
			"<option value='36'>Revathi</option>";
		break;
		default:
		    _opt="<option value='1'>Aswathy</option><option value='2'>Bharani</option><option value='31'>Kartika</option>";
		break;
	}
	return _opt;
}
function serStarForMoon(_chId)
{
     var opt = '<select name="star" id="star">'+getStarForRasi(_chId)+'<select>';
	 document.getElementById("stardiv").innerHTML = opt;
}
/* compose horo scripts ends here */

function married(val,trg)
{
	clearOption(trg);
	for(i=0;i<=val;i++)
	trg.appendChild(new Element('option',{value:i,text:i}));
}
function viewPayoutGad(cntreId)		
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'showPayoutGad',
								   caption:'Make Payout',ajaxCall:'get_payout_options_gad',
								   width:400,height:150,ePid:cntreId})); 
}
function showPayoutGad(form,ePid,ptype)		
{
	if(!validatePaymentForms(form,ptype)) return;
	form.action = _base+_index+'/gad_reports/make_payout/';
	form.submit();
}
function viewLatestMagazine(ePid)
{
	var cssClass = 'general_tab';
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'magazineOptions',
								   caption:'My Matrimonials',ajaxCall:'get_magazine_options',
								   width:400,height:150,ePid:ePid})); 
}
function magazineOptions(form,type)
{
	if(type == 'plan') {
	form.action = _base+_index+'/plans/';
	form.submit();
	}
}
function sent_sms_assistance(page)
{
	var cssClass = 'general_tab'; 
	$('container').appendChild(new generalPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'',
								   caption:'Special Assistance',ajaxCall:'sent_sms_assistance',
							   		width:520,height:100,ePid:page}));
}
function EnableAddressEditFields()
{
	$('div_btn_Edit').innerHTML = '';
	$('lbl_PhoneNoCode').style.visibility = 'hidden';
	$('lbl_PhoneNo').style.visibility = 'hidden';
	$('lbl_MobileNo').style.visibility = 'hidden';
	$('lbl_PhoneNoCode').innerHTML = '';
	$('lbl_PhoneNo').innerHTML = '';
	$('lbl_MobileNo').innerHTML = '';
	$('div_break').innerHTML = '';
	
	$('btn_Save').style.visibility = 'visible';
	$('phone_number_ccode').style.visibility = 'visible';
	$('phone_number').style.visibility = 'visible';
	$('mobile_phone_number').style.visibility = 'visible';
}

function ValidateContactDetails(_form)
{
	var ReturnFlag = false;
	var Flag = true;
	
	Flag = isEmptyValue(_form.phone_number_ccode,'','Phone number code');
	
	if(Flag == true)
		ReturnFlag = true;
	
	Flag = isEmptyValue(_form.phone_number,0,'Phone number');
	
	if(Flag == true)
		ReturnFlag = true;
	
	Flag = isEmptyValue(_form.mobile_phone_number,0,'Mobile number');
	
	if(Flag == true)
		ReturnFlag = true;
		
	if(ReturnFlag == false)
		_form.submit();

	return ReturnFlag;
}

/* START of new function added by ArunR on DEC 21 ... */

function getNewFPExpressInterestTab(elm, ePid, eName, ePIDPrefix)
{
	ePid = ePid + '|' + eName + '|' + ePIDPrefix;
	
	var cssClass = 'new_general_exp_int__tab';
	$('container').appendChild(new generalNewPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'',
								   caption:'Express Interest Free',ajaxCall:'get_New_FP_express_interest_options',
								   width:450,height:400,ePid:ePid}));
}

function NewAcceptInterestPopMessage(elm, mid, eip, eFullName)
{
	eipandFullName = eip + '|' + eFullName + '|' + mid;
	var cssClass = 'new_general_exp_int__tab';
	$('container').appendChild(new generalNewPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'',
								   caption:'Interest Accepted',ajaxCall:'get_InterestAccepted_Popup_Details',
								   width:450,height:400,ePid:eipandFullName})); 
}

function replyCustomExpressInterestMessage(eMessage)
{
	var cssClass = 'new_general_exp_int__tab';
	$('container').appendChild(new generalNewPopupTab({cssClass:cssClass,id:'replyMessage',submitFn:'sendNewCustomReplyMessage',
								   caption:'Personal Message Received',ajaxCall:'Get_Reply_ExpressInterest_Message_Options',
								   width:400,height:250,ePid:eMessage}));
}

function sendNewCustomReplyMessage(form, mId)
{
	var msg = form.txt_message.value;
	act = _base + _index +'/communication/FullProfile_Custom_Message_Reply/C/' + mId + '/' + msg;
	form.action = act;
	form.submit();
}

function PostExpressInterestandRequests(form, ePid)
{
	for(i=0; i<form.rd_exp_int.length; i++)
	{
		chk = form.rd_exp_int[i].checked ? form.rd_exp_int[i] : false;
		if(chk) 
			break; 
	}
	
	if(form.sms.checked == true) 
		sms = 1; 
	else 
		sms = 0;
		
	if(form.req_photo.checked == true) 
		reqPhoto = 1; 
	else 
		reqPhoto = 0;
		
	if(form.req_horo.checked == true) 
		req_horo = 1; 
	else 
		req_horo = 0;
		
	if(form.shortlist_profile.checked == true) 
		shortlist = 1; 
	else 
		shortlist = 0;

	var msg = (chk.value == "C") ? form.txt_message.value : 'null';

	showInfo(null,'Sending Message ...');
	_url =	_base + _index + '/ajax_call/Send_ExpressInterest_and_Requests/' + chk.value + '/' + ePid + '/' + msg + '/' + 
			sms + '/' + reqPhoto + '/' + req_horo + '/' + shortlist + '/';

	rq = new Request(
						  { 
							url:_url + Math.random(),
							method:'get',
							onSuccess: function(responseText)
							{
								if(responseText.indexOf('success')>=0)
									showInfo(chk,'Message Sucessfully Posted');
								else
									showError(chk,'Error Posting Message. Sorry for the inconvenience' );
							},
							onError:function()
							{
								showError(chk,"Request Timed Out!");
							}
						  }
					  );
	rq.send();
	
}

function doMultipleRequest(ePid)
{
		rq = new Request(
						  { 
							url:_base + _index + '/ajax_call/send_photo_request/' + ePid + '/' + Math.random(),
							method:'get',
							onSuccess: function(responseText) 
							{
								showInfo(null,"Your photo request is successfully sent.");
								
								var cssClass = 'new_general_exp_int__tab';
								$('container').appendChild(new generalNewPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'',
															   caption:'Send Other Requests',ajaxCall:'Get_Other_Requests_Popup',
															   width:450,height:400,ePid:ePid}));
							},
							onError:function()
							{
								showError(chk,"Request Timed Out!");
							}
						  }
					  );
	rq.send();

}

function PostOtherRequests(form, ePid)
{
	if(form.req_horo.checked == true) 
		req_horo = 1; 
	else 
		req_horo = 0;
		
	if(form.shortlist_profile.checked == true) 
		shortlist = 1; 
	else 
		shortlist = 0;

	if(req_horo == 1 || shortlist == 1)
	{
		showInfo(null,'Sending Message ...');

		_url =_base + _index + '/ajax_call/Send_Other_Requests/' + ePid + '/' + req_horo + '/' + shortlist + '/';

		rq = new Request(
						  { 
							url:_url + Math.random(),
							method:'get',
							onSuccess: function(responseText)
							{
								if(responseText.indexOf('success')>=0)
									showInfo(chk,'Message Sucessfully Posted');
								else
									showError(chk,'Error Posting Message. Sorry for the inconvenience' );
							},
							onError:function()
							{
								showError(chk,"Request Timed Out!");
							}
						  }
					  );
		rq.send();

	}

	removeElement('mx_dialog');
}

function HoroscopeMatchingRequestPopups(LoggedInUserID, LoggedUserHasHoroscope, OtherUserID, OtherUserHasHoroscope, OtherUserName, 
										UserGender, OtherUserGender, OtherUserIDPrefix)
{
	var MessageCaption;
	var ePid;
	
	ePid = 	LoggedInUserID + '|' + LoggedUserHasHoroscope + '|' + OtherUserID + '|' + OtherUserHasHoroscope + '|' + 
			OtherUserName + '|' + UserGender + '|' + OtherUserGender + '|' + OtherUserIDPrefix;
			
	if(LoggedInUserID == '')
		MessageCaption = 'Horoscope Matching';
	else if(LoggedUserHasHoroscope == 0 && OtherUserHasHoroscope == 0)
		MessageCaption = 'Request / add horoscope';
	else if(LoggedUserHasHoroscope == 0)
		MessageCaption = 'Add Horoscope';
	else
		MessageCaption = 'Request Horoscope';

	var cssClass = 'new_general_exp_int__tab';
	$('container').appendChild(new generalNewPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'',
								   caption:MessageCaption,ajaxCall:'get_Horoscope_Matching_Popup_details',
								   width:450,height:400,ePid:ePid}));
}

function getFPLoginPopup(form)
{
	var cssClass = 'new_general_exp_int__tab';
	$('container').appendChild(new generalLoginNowPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'',
								   caption:'Login Now',ajaxCall:'get_Popup_for_Login',
								   width:400,height:450,'':''}));
}

function getFPRegisterNowPopup(form)
{
	var cssClass = 'new_general_exp_int__tab';
	$('container').appendChild(new FullProfileNewRegisterationPopup({cssClass:cssClass,id:'generaltab',submitFn:'',
								   caption:'Login Now',ajaxCall:'get_FullProfile_New_Registration_Popup_Details',
								   width:710,height:1500,'':''}));
}

function viewFPPhoneNumber(eip, eFullName, ePidPrefix)
{
	ePid = eip + '|' + eFullName + '|' + ePidPrefix;

	var cssClass = 'new_general_exp_int__tab';
	$('container').appendChild(new generalNewPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'showContactNumber',
								   caption:'Contact Information',ajaxCall:'get_FP_account_statistics_options',
								   width:400,height:150,ePid:ePid}));
}

function viewFPAddress(eip, eFullName, ePidPrefix)
{
	ePid = eip + '|' + eFullName + '|' + ePidPrefix;

	var cssClass = 'new_general_exp_int__tab';
	$('container').appendChild(new generalNewPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'showAddress',
								   caption:'Contact Address',ajaxCall:'get_FP_account_statistics_options',
								   width:400,height:150,ePid:ePid}));
}

function requestFPphoto(eip, eFullName, ePidPrefix, eGender)
{
	ePid = eip + '|' + eFullName + '|' + ePidPrefix + '|' + eGender;

	var cssClass = 'new_general_exp_int__tab';
	$('container').appendChild(new generalNewPopupTab({cssClass:cssClass,id:'generaltab',submitFn:'doRequestHoroscope',
								   caption:'Request Photograph',ajaxCall:'get_FP_photo_request_options',
								   width:400,height:250,ePid:ePid}));
}

/* END of new function added by ArunR on DEC 21 ... */
