function get_adfeatures_singledel(adid)
{
	var n = confirm("Are you sure to delete this listing?");
	if(n==1)
	{
		window.location.href = weblink+"welcome/del_listingssingle/"+adid;
	}
}
function getlistings_byid(id)
{
	if(id>0)
	{
		window.location.href = weblink+"mail-box/"+id;
	} else {
		window.location.href = weblink+"mail-box/";
	}
}
function register_link()
{
	window.location=weblink+'register/';
}
function register_links()
{
	window.location=weblink+'register/';
}
function get_adfeatures(id)
{
	//var id = document.getElementById('category');
	if(id!="")
	{
		window.location.href = weblink+"classifieds-newads/"+id;
	}
	else
	{
		alert("Select a category to create listing");
		id.focus();
	}
}
function alertbukmails()
{
	var x = confirm('Please upload contacts to send bulk mails. For uploading contacts press ok ,to stay with the same press cancel')
		if(x)
		{
			window.location.href = weblink+'import-emails/';
		}
		else
		{
			window.location.href = weblink+'my-classified-ads/0/0/4/0/0/0/';
		}
}
function get_adfeaturesskip()
{
	window.location.href = weblink+'my-classified-ads/0/0/4/0/0/0/';
}
function get_settingspageskip()
{
	window.location.href = weblink+'classifieds-newads';
}
function get_adfeatures_message() 
{
    alert("Your account is expired. Please renew or upgrade your plan to create new listings.");
}
function get_adcreatelimit_message()
{
    alert("You have reached the total allowable listings for your business plan. Please renew or upgrade your plan to create new listings.");
}
function get_adfeatures_publish() 
{
    alert("You have reached the total allowable listings for your business plan, Please renew or upgrade your plan to create new listings or unpublish the old published listings.");
}
function get_adfeatures_accexpire()
{
	alert("Your business plan is expired. Please renew or upgrade your plan to publish new listings.");
}
function upgrades()
{
	window.location=weblink+'welcome/upgrade';
}
//MAKE THE TEXT DISABLED WHEN CLICK ON THE TEXT BOX
function defaultextonclick()
{
	document.getElementById('ads_id').value="";
}
function defaultextonclickname()
{
	document.getElementById("themename").value="";
}
function defaultloginemail()
{
	document.getElementById('username1').value="";
}
function defaultloginpwd()
{
	
	document.getElementById('password1').value="";
}
function regvalidate()
{
	var id1=document.getElementById("username1");
	var id2=document.getElementById("password1");
	var lbl=document.getElementById("valid");
	if(checkTextEmpty(id1,"Username",lbl) && checkTextEmpty(id2,"Password",lbl))
	{
		return true;
	}
	else return false;
}
function back_testimonials()
{
	window.location=weblink+'welcome/testimonials';
}
//FORM VALIDATION FOR THE SEARCH BOX IN HOME PAGE
function sublistfrm()
{
	var lis= document.getElementById('ads_id').value;
	if(lis=='Enter Listing-id Here' || lis=='')
	{
		alert("Please enter Listing Id");
		return false;
	}
	else
	{
		return true;
	}
}
function sublistfrms()
{
	var id1=document.getElementById("ads_id");
	if(id1.value=='')
	{
		alert("Please enter atleast one search term");
		return false;
	}
	else
	{
		return true;
	}
}
function changeplan()
{
	var id1=document.getElementById("bplan");
	if(id1.value=='0')
	{
		alert("Please select business plan");
		return false;
	}
	else
	{
		return true;
	}
}
function editvalid()
{
	var id1=document.getElementById("themename");
	if(id1.value=='')
	{
		alert("Please enter theme name");
		return false;
	}
	else
	{
		return true;
	}
	
}
function revertvalid()
{
	//alert("hai");
	window.location.reload(); 
}
/**
 * Validations For my-listings page
 * @return
 */
// Validation For Search in my-listings page
function mylistsearchvalidate()
{
	var id1=document.getElementById("category");
	var id2=document.getElementById("listid");
	var id3=document.getElementById("status");
	var id4=document.getElementById("subuser");
	var id5=document.getElementById("pfrom_date");
	var id6=document.getElementById("pto_date");
	var lbl=document.getElementById("conform");
	
	if((id1.value=='') && (id2.value=='') && (id3.value=='') && (id4.value=='') && (id5.value=='') && (id6.value==''))
	{
		alert("Please enter atleast one search term");
		return false;		
	}
	else
	{
		if(id5.value!='' && id6.value!='')
		{
			if(id3.value =='4')
			{
				alert("please select status");
				return false;
			}
			else if(id5.value <= id6.value)
			{
				return true;
			}
			else
			{
				alert("'Date from' should be lesser than 'Date to' and Date to must be lesser than or equal to present date");
				return false;
			}	
		}
	}
}
/*
 * Theme javascript starts
 */
//background color
function selected_theme_value(elementname,colorval,adid)
{
	//alert(elementname);
	var obj = document.getElementById(elementname);
	var val = "#"+colorval;
	obj.style.background = val;
	setCookie('text-color',val);
	
}
//font color
function selected_theme_font_value(elementname,colorval,adid)
{
	//alert(elementname);
	var obj = document.getElementById(elementname);
	var val = "#"+colorval;
	obj.style.color = val;
	
}


//SWETHA code

//Validation for select and deselect in my-listings page
var flag=false;
function select_deselectAll (chkVal, idVal)
{ 
	
	var frm = document.forms[0];
	//alert(frm);
	
       //alert(frm.length);
    for (i=0; i<frm.length; i++)
    {  
	//alert(idVal.indexOf ('chkAll'));
        if (idVal.indexOf ('chkAll') != -1)
        {
			
            if(chkVal == true)
            {	
				
                frm.elements[i].checked = true;
            }
            else
            {	//alert(frm.length);
                frm.elements[i].checked = false;
				
            }
        }
        else if (idVal.indexOf ('checklist') != -1)
        {
			
            if(frm.elements[i].checked == false)
            {	//alert(frm.length);
				
                document.getElementById("chkAll").checked=false;
                frm.elements[0].checked = false; 
            }
			else
			{
				
			}
        }
    }
	var c=frm['checklist[]'];
	var t=0;
	for(var i=0;i<c.length;i++)
	{

		c[i].checked?t++:null;
		//alert("c[i].checked");
	}
	
	if(c.length==null)
	{
		if(flag==false)
		{
			flag=true;
			document.getElementById("chkAll").checked=true;
		}
		else
		{
			flag=false;
			document.getElementById("chkAll").checked=false;
		}
	}
	else if(t==c.length)
	{
		document.getElementById("chkAll").checked=true;
	}
	
}
//validation for select and deselect all in my-listings page
function select_deselectAlls (chkVal, idVal)
{ 
	
	var frm = document.forms[1];
	//alert(frm.value);
      // alert(frm.length);
    for (i=0; i<frm.length; i++)
    {  
	//alert(idVal.indexOf ('chkAll'));
        if (idVal.indexOf ('chkAll') != -1)
        {
			
            if(chkVal == true)
            {	
				
                frm.elements[i].checked = true;
            }
            else
            {	//alert(frm.length);
                frm.elements[i].checked = false;
				
            }
        }
        else if (idVal.indexOf ('checklist') != -1)
        {
			
            if(frm.elements[i].checked == false)
            {	//alert(frm.length);
				
                document.getElementById("chkAll").checked=false;
                frm.elements[0].checked = false; 
            }
			else
			{
				
			}
        }
    }
	var c=frm['checklist[]'];
	var t=0;
	for(var i=0;i<c.length;i++)
	{

		c[i].checked?t++:null;
		//alert("c[i].checked");
	}
	
	if(c.length==null)
	{
		if(flag==false)
		{
			flag=true;
			document.getElementById("chkAll").checked=true;
		}
		else
		{
			flag=false;
			document.getElementById("chkAll").checked=false;
		}
	}
	else if(t==c.length)
	{
		document.getElementById("chkAll").checked=true;
	}
	
}

//select or deselect all list in the new listing page
function select_deselectAll_list(chkVal, idVal)
{
	var frm = document.forms[0];
	//alert(frm);
	
       //alert(frm.length);
    for (i=0; i<frm.length; i++)
    {  
	//alert(idVal.indexOf ('chkAll'));
        if (idVal.indexOf ('chkAlls') != -1)
        {
			
            if(chkVal == true)
            {	
				
                frm.elements[i].checked = true;
            }
            else
            {	//alert(frm.length);
                frm.elements[i].checked = false;
				
            }
        }
        else if (idVal.indexOf ('syn_list') != -1)
        {
			
            if(frm.elements[i].checked == false)
            {	//alert(frm.length);
				
                document.getElementById("chkAlls").checked=false;
                frm.elements[0].checked = false; 
            }
			else
			{
				
			}
        }
    }
	var c=frm['syn_list[]'];
	var t=0;
	for(var i=0;i<c.length;i++)
	{

		c[i].checked?t++:null;
		//alert("c[i].checked");
	}
	
	if(c.length==null)
	{
		if(flag==false)
		{
			flag=true;
			document.getElementById("chkAlls").checked=true;
		}
		else
		{
			flag=false;
			document.getElementById("chkAlls").checked=false;
		}
	}
	else if(t==c.length)
	{
		document.getElementById("chkAlls").checked=true;
	}
}

//validation for date in traffic graphs page
function validatetrafficform()
{
	var id1=document.getElementById("from_date").value;
	var id2=document.getElementById("to_date").value;
	var lbl=document.getElementById("valid");
	
	var currentTime = new Date();
	var month = currentTime.getMonth() +1;
	var day = currentTime.getDate();
	var year = currentTime.getFullYear();
	var current= day + "/" + month + "/" + year;
	
	if((id1.value=='') && (id2.value==''))
	{
		alert("Please enter one search term");
		return false;	
	}
	else
	{
		if(id1!='' && id2!='')
		{
			
			if((id1 <= id2) && (id1 <= current) && (id2 <= current))
			{
				return true;
			}
			else
			{
				alert("Date from should be lesser than date to, Date to must be lesser than or equal to present date");

				return false;
			}	
		}
	}
	
	if((id1,"From Date",lbl) && checkTextEmpty(id2,"To Date",lbl))
	{
	}
	else
	{
		var seldate=id1.value;
		var enddate=id2.value;
		
		if((seldate <= enddate) && (seldate <= current) && (enddate <= current))
		{
	    	return true;
		}
		else
		{
			alert("Start date should be lesser than end date and end date must be lesser than or equal to present date");
			return false;
		}
	}
}

// Validation for settings page 
	function settingsform()
{
	var id1=document.getElementById("settingyesmail");
	var lbl=document.getElementById("conformss");
	if(checkTextEmpty(id1,"Email",lbl) && validateEmail(id1,'email',lbl) && checksettingemailexist())
	{
	}
	else
	{
		return false;
	}
	
}
	function checkemailexist()
{
	var lbl=document.getElementById("errordisplay")
	var email=document.getElementById("emailid").value;
	var emstr=email.split("@");//alert("emstr0===>"+emstr[0]);alert("emstr1===>"+emstr[1]);
	xmlHttp.open('GET',weblink+"welcome/emailcheck/"+emstr[0]+"/"+emstr[1]+"", false);
	xmlHttp.send(null); 
	var str=xmlHttp.responseText;
	var str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
	if(str=="Exist")
	{
		lbl.innerHTML="Provided email address already exist";
		document.getElementById("emailid").value="";
		return false;
	}
	else 
	{
		lbl.innerHTML=""
		return true;
	}
	
}
// checking the exixting mail
function checksettingemailexist()
{
	var lbl=document.getElementById("conformss")
	var email=document.getElementById("settingyesmail").value;
	var emstr=email.split("@");
	xmlHttp.open('GET',weblink+"welcome/settingemailcheck/"+emstr[0]+"/"+emstr[1]+"", false);
	xmlHttp.send(null); 
	var str=xmlHttp.responseText;
	var str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
	//alert(str);
	if(str=="Exist")
	{
		//alert("yes");
		lbl.innerHTML="Email address already exist, Please try with another";
		
		return false;
		
	}
	else 
	{
		//alert("no");
		lbl.innerHTML=""
		return true;
	}
}
// validation for delete 
function mylistingsvalidate()
{
	
	var frm = document.mylistform;
	var checkboxArr = document.getElementById('mylistform').getElementsByTagName("input");
	//alert(checkboxArr);
	var numChecked = 0	;
	for (i=1; i<checkboxArr.length; i++)
	{
		if (checkboxArr[i].type == "checkbox" && checkboxArr[i].checked == true)
		numChecked++;
	}
	//var count=document.getElementById('hid').value;
	/*if(count=='0')
	{
		alert("There is no suggestion listed to delete");
		return false;
	}*/
	
	if(numChecked <= 0)
	{
		alert("Please select atleast one list to delete");
		return false;
	}	
	else 
	{
		var x=confirm("Are you sure to delete selected listings? ")	
		if(x)
		{
			return true;
		}
		else
		{
			window.location.reload();
			return false;
		}
		
	}
	
}

/*
 * Validation code for user profile information
 */
function user_profile_validate()
{
	var id1=document.getElementById('fullname');	
	var id2=document.getElementById('email');
	//var id3=document.getElementById('agent_id');
	var id4=document.getElementById('address1');
	var id5=document.getElementById('ccountry');
	var id6=document.getElementById('cstate');
	var id7=document.getElementById('city');	
	var id8=document.getElementById('pin');
	var id9=document.getElementById('phone');
	var id10=document.getElementById('userfile');
	var id11=document.getElementById('website');
	var id12=document.getElementById('userfile_logo');
	var lbl=document.getElementById('error');
	if(checkTextEmpty(id1,'Full Name',lbl) && Name_FirstCharacter_Check(id1,'Full Name',lbl) && 
			first_character_space_check(id1,'Full Name',lbl) && 
			checkTextEmpty(id2,'Email-Id',lbl) && 
			validateEmail(id2,'Email-Id',lbl) && 
			newvalidateEmail(id2,'Email-Id',lbl) &&
			//checkTextEmpty(id3,'Agent id',lbl) && 
			checkTextEmpty(id4,'Address1 field',lbl) && 			
			checkSelEmpty(id5,'country',lbl) &&
			checkSelEmpty(id6,'state',lbl) &&
			checkTextEmpty(id7,'City',lbl) &&
			checkTextEmpty(id8,'Pin code',lbl) && 
			ValidNumtext(id8,'Pin code',lbl) && 
			checkTextEmpty(id9,'Phone number',lbl) &&
			//numbercheck(id9,'Phone number',lbl) &&
			ValidNumber(id9,'Phone number',lbl) && 
			checkTextEmpty(id11,'Website',lbl) && 
			urlvalidation(id11,'Website URL is not correct',lbl) && 
			checkTextEmpty(id10,'Profile Image',lbl) && 
			checkTextEmpty(id12,'Company logo',lbl)
			)
	{
	}
	else
	{
		return false;
	}
}
//state ajax code to fetch based on country
function getcstates(scid)
{
	xmlhttp.open('GET', weblink+"welcome/getstates/" + scid , false);
	xmlhttp.send(null); 
	str=xmlhttp.responseText;
	str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
	//alert(str);
	if(str=="0")
	{
		var slen=document.getElementById("cstate").options.length;
		for(j=slen;j>=0;j--)
		{
			document.getElementById("cstate").remove(j);
		}	
		var optn = document.createElement("OPTION");
		optn.text = "Select";
		optn.value = "0";
		document.getElementById("cstate").options.add(optn);
	}
	
	else
	{
		var myarray=str.split("~");
		//alert(myarray);
		var idarr1=myarray[0];
		//alert(idarr1);
		var routearr1=myarray[1];
		//alert(routearr1);
		var idarr=idarr1.split(",");
		//alert(idarr);
		//alert(idarr.length)
		var routearr=routearr1.split(",");
		//alert(routearr)
		var slen=document.getElementById("cstate").options.length;
		for(j=slen;j>=0;j--)
		{
			document.getElementById("cstate").remove(j);
		}	
		var optn = document.createElement("OPTION");
		optn.text = "Select";
		optn.value = "0";
		document.getElementById("cstate").options.add(optn);
		for (i=0;i<(idarr.length)-1;i++)
		{
			var optn = document.createElement("OPTION");
			optn.text = routearr[i];
			optn.value = idarr[i];
			//alert(optn.value);
			document.getElementById("cstate").options.add(optn);
		}
	
	}
	
}
function getlistingsstates(scid)
{
	xmlhttp.open('GET', weblink+"welcome/getstates/" + scid , false);
	xmlhttp.send(null); 
	str=xmlhttp.responseText;
	str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
	//alert(str);
	if(str=="0")
	{
		var slen=document.getElementById("cstate").options.length;
		for(j=slen;j>=0;j--)
		{
			document.getElementById("cstate").remove(j);
		}	
		var optn = document.createElement("OPTION");
		optn.text = "Select";
		optn.value = "0";
		document.getElementById("cstate").options.add(optn);
	}
	
	else
	{
		var myarray=str.split("~");
		//alert(myarray);
		var idarr1=myarray[0];
		//alert(idarr1);
		var routearr1=myarray[1];
		//alert(routearr1);
		var idarr=idarr1.split(",");
		//alert(idarr);
		//alert(idarr.length)
		var routearr=routearr1.split(",");
		//alert(routearr)
		var slen=document.getElementById("cstate").options.length;
		for(j=slen;j>=0;j--)
		{
			document.getElementById("cstate").remove(j);
		}	
		var optn = document.createElement("OPTION");
		optn.text = "Select";
		optn.value = "0";
		document.getElementById("cstate").options.add(optn);
		for (i=0;i<(idarr.length)-1;i++)
		{
			var optn = document.createElement("OPTION");
			optn.text = routearr[i];
			optn.value = idarr[i];
			//alert(optn.value);
			document.getElementById("cstate").options.add(optn);
		}
	
	}
}
function getstates(scid)
{
	
	xmlhttp.open('GET', weblink+"welcome/getstates/" + scid , false);
	xmlhttp.send(null); 
	str=xmlhttp.responseText;
	str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
	//alert(str);
	if(str=="0")
	{
		var slen=document.getElementById("lstate").options.length;
		for(j=slen;j>=0;j--)
		{
			document.getElementById("lstate").remove(j);
		}	
		var optn = document.createElement("OPTION");
		optn.text = "Select";
		optn.value = "0";
		document.getElementById("lstate").options.add(optn);
		
	}
	
	else
	{
		var myarray=str.split("~");
		//alert(myarray);
		var idarr1=myarray[0];
		//alert(idarr1);
		var routearr1=myarray[1];
		//alert(routearr1);
		var idarr=idarr1.split(",");
		//alert(idarr);
		//alert(idarr.length)
		var routearr=routearr1.split(",");
		//alert(routearr)
		var slen=document.getElementById("lstate").options.length;
		for(j=slen;j>=0;j--)
		{
			document.getElementById("lstate").remove(j);
		}	
		var optn = document.createElement("OPTION");
		optn.text = "Select";
		optn.value = "0";
		document.getElementById("lstate").options.add(optn);
		for (i=0;i<(idarr.length)-1;i++)
		{
			var optn = document.createElement("OPTION");
			optn.text = routearr[i];
			optn.value = idarr[i];
			//alert(optn.value);
			document.getElementById("lstate").options.add(optn);
		}
	
	}
}
	function get_profiles_by_id(pid)
{
	xmlhttp.open('GET', weblink+"welcome/getprofiles/" + pid , false);
	xmlhttp.send(null); 
	str=xmlhttp.responseText;
	str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
	//alert(str);
	if(str=='Norecords')
	{
		document.getElementById("profieldet").innerHTML = '';
	}
	else
	{
		document.getElementById("profieldet").innerHTML = str;
		document.getElementById("prodeteat").innerHTML = '';
	}
}
	//delete company logo function
	
	function delete_company_logo(p_id)
	{
		var n = confirm("Are you sure to remove this image ?");
		if(n==1)
		{
			xmlHttp.open('GET', weblink+"welcome/delete_user_company_logo/" + p_id, false);
			xmlHttp.send(null); 
			str=xmlHttp.responseText;
			str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
			if(str>0)
			{
				document.getElementById("update_photo").value='1';
				document.forms["formular"].submit();
			}
		}
		
	}
	function delete_profile_image(p_id)
	{
		var n = confirm("Are you sure to remove this image ?");
		if(n==1)
		{

			xmlHttp.open('GET', weblink+"welcome/delete_user_image/" + p_id, false);
			xmlHttp.send(null); 
			str=xmlHttp.responseText;
			str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
			
			if(str>0)
			{
				document.getElementById("update_photo").value='1';
				document.forms["formular"].submit();
			}
		}
	}
	function getthemes(thmid)
	{
		//alert("hai");
		xmlhttp.open('GET', weblink+"welcome/getthemes/" + thmid , false);
		xmlhttp.send(null); 
		str=xmlhttp.responseText;
		str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
		//alert(str);
		if(str=='Norecords')
		{
			document.getElementById("themedisplay").innerHTML = '';
		}
		else
		{
			document.getElementById("themedisplay").innerHTML = str;
		}
		
	}
	function getthemesapply(thmid,adid)
	{
		xmlhttp.open('GET', weblink+"welcome/getthemesapply/" + thmid +"/"+ adid , false);
		xmlhttp.send(null); 
		str=xmlhttp.responseText;
		str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
		//alert(str);
		if(str=='Norecords')
		{
			document.getElementById("themedisplay").innerHTML = '';
		}
		else
		{
			document.getElementById("themedisplay").innerHTML = str;
		}
		
	}
	function getemails(edid)
	{
		xmlhttp.open('GET', weblink+"welcome/getemaildids/"+edid , false);
		xmlhttp.send(null); 
		str=xmlhttp.responseText;
		str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
		//alert(str);
		if(str!='')
		{
			document.getElementById("emaidlidis").innerHTML = str;
		}
		else
		{
			document.getElementById("emaidlidis").innerHTML = '';
		}
	}
	
	//settings page function for changing email
	function change_setngs_email()
	{
		document.getElementById("email_display").style.display="none";
		document.getElementById("email_nodisplay").style.display="block";
	}
	/*function change_setngs_emailnodisp()
	{
		document.getElementById("email_display").style.display="none";
	}
/*
 * Code for manage profile information to navigate to the next page
 */

	function manage_profile_function()
{
	window.location=weblink+'add-classified-account';
}
	function message_alert(uid)
	{
		var num=confirm("You have tried to delete sub domain. Please check and proceed with this operation. If you still want to continue with deleting, Press ok, if not press cancel.");
		if(num==true)
		{
			window.location=weblink+'welcome/delete_domain/'+ uid;
		}
		else
		{
			window.location=weblink+'manage-domain';
		}
	}
	function messages(pid)
	{	
		var num=confirm("You have tried to delete this profile.Please check and proceed with this operation.If you still want to continue with deleting, Press Ok, if not continue saying Cancel.");
		if(num==true)
		{
			window.location=weblink+'delete-classified-account/'+ pid;
		}
		else
		{
			window.location=weblink+'free-classified-account';
		}
	}
	function delete_user_theme(temp_model,id,user_id)
	{
		var num=confirm("Are you sure want to delete themes?");
		if(num==true)
		{
			window.location=weblink+'delete-custom-themes/'+ temp_model + '/' + id + '/' + user_id;
		}
		else
		{
			window.location=weblink+'display-user-themes';
		}
	}
	function new_listings()
	{
		window.location=weblink+'classifieds-newads';
	}
	function subuser_active(user_id)
	{
		var message = confirm("Do you want to activate subuser");
		if(message==true)
		{
			window.location=weblink+'welcome/active_manage_sub_user/' + user_id;
		}
		else
		{
			window.location=weblink+'manage-subusers';
			return false;
		}
	}
	function subuser_inactive(user_id)
	{
		var message = confirm("Do you want to inactivate subuser");
		if(message==true)
		{
			window.location=weblink+'welcome/inactive_manage_sub_user/' + user_id;
		}
		else
		{
			window.location=weblink+'manage-subusers';
			return false;
		}
	}
	
	
/*
*code for the search in home page
*/
	function searchbyid(fname)
	{
		window.location=weblink+'search/'+fname+'/location/';
	}
/*
* Code for feedback information to navigate to the controller page
*/
	function feedback_function_call()
{
	window.location=weblink+'new-feedback';
}
function inbox_back_function()
{
	window.location=weblink+'mail-box';
}
/*
 * code to validate new feedback
 */
	function new_feedback_validate()
	{
		var id1=document.getElementById('category');	
		var id2=document.getElementById('title');
		var id3=document.getElementById('description');		
		
		var lbl=document.getElementById('errors');
		
		if(checkSelEmpty(id1,'Feedback type',lbl) && 
			checkTextEmpty(id2,'Title',lbl) && 
			checkTextEmpty(id3,'Description',lbl))
		{
		}
		else
		{
			return false;
		}
	}
/*
 * code for checbox selection condition
 */
	function select_deselectAlls (chkVal, idVal)
	{ 
		
		var frm = document.forms[1];
		//alert(frm.value);
	      // alert(frm.length);
	    for (i=0; i<frm.length; i++)
	    {  
		//alert(idVal.indexOf ('chkAll'));
	        if (idVal.indexOf ('chkAll') != -1)
	        {
				
	            if(chkVal == true)
	            {	
					
	                frm.elements[i].checked = true;
	            }
	            else
	            {	//alert(frm.length);
	                frm.elements[i].checked = false;
					
	            }
	        }
	        else if (idVal.indexOf ('checklist') != -1)
	        {
				
	            if(frm.elements[i].checked == false)
	            {	//alert(frm.length);
					
	                document.getElementById("chkAll").checked=false;
	                frm.elements[0].checked = false; 
	            }
				else
				{
					
				}
	        }
	    }
		var c=frm['checklist[]'];
		var t=0;
		for(var i=0;i<c.length;i++)
		{

			c[i].checked?t++:null;
			//alert("c[i].checked");
		}
		
		if(c.length==null)
		{
			if(flag==false)
			{
				flag=true;
				document.getElementById("chkAll").checked=true;
			}
			else
			{
				flag=false;
				document.getElementById("chkAll").checked=false;
			}
		}
		else if(t==c.length)
		{
			document.getElementById("chkAll").checked=true;
		}
		
	}
	
	function import_fun()
	{
		window.location=weblink+'welcome/import_emails';		  
	}
	/*
	 * delete function call
	 */
	function feedback_delete_call()
	{		
		window.location=weblink+'welcome/del_suggestion';		  
	}
	/*
	 * To get the value from the from
	 */
	
	function my_contacts_validate()
	{
		
		var frm = document.mylistform;
		var checkboxArr = document.getElementById('contacts').getElementsByTagName("input");
		var numChecked = 0;
		for (i=1; i<checkboxArr.length; i++)
		{
			if (checkboxArr[i].type == "checkbox" && checkboxArr[i].checked == true)
			numChecked++;
		}
		//var count=document.getElementById('hid').value;
		/*if(count=='0')
		{
			alert("There is no suggestion listed to delete");
			return false;
		}*/
		
		if(numChecked <= 0 )
		{
			alert("Please select atleast one List to delete");
			return false;
		}	
		else 
		{
			var x=confirm("Are you sure to delete selected group name? ")	
			if(x)
			{
				return true;
			}
			else
			{
				window.location.reload();
				return false;
			}
			
		}
		
	}
	function mylistvalidate()
	{
		var frm = document.mylistform;
		var checkboxArr = document.getElementById('mylistform').getElementsByTagName("input");
		var numChecked = 0;
		for (i=1; i<checkboxArr.length; i++)
		{
			if (checkboxArr[i].type == "checkbox" && checkboxArr[i].checked == true)
			numChecked++;
		}
		if(numChecked <= 0 )
		{
			alert("Please select atleast one List to delete");
			return false;
		}	
		else 
		{
			var x=confirm("Are you sure to delete selected feedback(s)? ")	
			if(x)
			{
				return true;
			}
			else
			{
				window.location.reload();
				return false;
			}
			
		}
		
	}
	function myinboxvalidate()
	{
		
		var frm = document.mylistform;
		var checkboxArr = document.getElementById('mylistform').getElementsByTagName("input");
		var numChecked = 0;
		for (i=1; i<checkboxArr.length; i++)
		{
			if (checkboxArr[i].type == "checkbox" && checkboxArr[i].checked == true)
			numChecked++;
		}
		//var count=document.getElementById('hid').value;
		/*if(count=='0')
		{
			alert("There is no suggestion listed to delete");
			return false;
		}*/
		
		if(numChecked <= 0 )
		{
			alert("Please select atleast one List to delete");
			return false;
		}	
		else 
		{
			var x=confirm("Are you sure to delete selected inbox information? ")	
			if(x)
			{
				return true;
			}
			else
			{
				window.location.reload();
				return false;
			}
			
		}
		
	}
	function myemailsvalidate()
	{
		
		var frm = document.mylistform;
		var checkboxArr = document.getElementById('mailids').getElementsByTagName("input");
		//alert(checkboxArr);
		var numChecked = 0;
		for (i=1; i<checkboxArr.length; i++)
		{
			if (checkboxArr[i].type == "checkbox" && checkboxArr[i].checked == true)
			numChecked++;
		}
		//var count=document.getElementById('hid').value;
		/*if(count=='0')
		{
			alert("There is no suggestion listed to delete");
			return false;
		}*/
		
		if(numChecked <= 0 )
		{
			alert("Please select atleast one list to add group");
			return false;
		}	
		else 
		{
			var id1 = document.getElementById('gname');
			if(id1.value=='')
			{
				alert('Please add group name');
				return false;
			}
			else
			{
				return true;
			}
		}
		
	}
	//syndication list validataion
	function synvalidate()
	{
		var frm = document.synform;
		var checkboxArr = document.getElementById('synform').getElementsByTagName("input");
		//alert(checkboxArr);
		var numChecked = 0;
		for (i=1; i<checkboxArr.length; i++)
		{
			if (checkboxArr[i].type == "checkbox" && checkboxArr[i].checked == true)
			numChecked++;
		}
		//var count=document.getElementById('hid').value;
		/*if(count=='0')
		{
			alert("There is no suggestion listed to delete");
			return false;
		}*/
		
		if(numChecked <= 0 )
		{
			alert("Please select atleast one syndication list");
			return false;
		}	
		else 
		{
			return true;
		}
	}
	/*
	 * manage subuser controller function call
	 */
	function manage_subuser_function()
	{
		window.location=weblink+'create-sub-user';
	}
	/*
	 * calling add profile function
	 */
	function back_function()
	{
		window.location=weblink+'free-classified-account';
	}
	/*
	 * calling manage sub user
	 */
	function sub_back_function()
	{
		window.location=weblink+'manage-sub-user';
	}
	/*
	 * calling manage feedback
	 */
	function feedback_back_function()
	{
		window.location=weblink+'feedback';
	}
	/*
	 * calling news parent function
	 */
	function news_back_function()
	{
		window.location=weblink+'latest-news';
	}
	/*
	 * create_sub_user_validate function
	 */
	
	function create_sub_user_validate()
	{
		var id1=document.getElementById('fullname');	
		var id2=document.getElementById('email');
		
		var id3=document.getElementById('password');
		var id4=document.getElementById('confpassword');
		
		var lbl=document.getElementById('error');
		if(checkTextEmpty(id1,'Full Name',lbl) && Name_FirstCharacter_Check(id1,'Full Name',lbl) && 
				checkTextEmpty(id2,'Email-Id',lbl) && 
				validateEmail(id2,'Email-Id',lbl) && 
				newvalidateEmail(id2,'Email-Id',lbl) &&				
				checkTextEmpty(id3,'Password field',lbl) && 				
				checkTextEmpty(id4,'Confirm password',lbl) &&
				comparepasswords(id3,id4,lbl)
				)
		{
		}
		else
		{
			return false;
		}
	}
	
	/*
	 * change password function
	 */
	function change_password_validate()
	{
		var id1=document.getElementById('password');	
		var id2=document.getElementById('confpassword');		
		
		var lbl=document.getElementById('error');
		if(checkTextEmpty(id1,'Password field',lbl) && 								
				checkTextEmpty(id2,'Confirm password field',lbl) && 
				comparepasswords(id1,id2,lbl)
				)
		{
		}
		else
		{
			return false;
		}
	}
/*
 * packages function
 */
	function register_plan(num)
	{		
		window.location=weblink+'register/'+num;		  
	}
	function register()
	{
		window.location=weblink+'upgrade';
	}
	function monthly_display()
	{
		document.getElementById("monthly_disp").style.display="block";
		document.getElementById("yearly_disp").style.display="none";	
	}
	function yearly_display()
	{
		document.getElementById("monthly_disp").style.display="none";
		document.getElementById("yearly_disp").style.display="block";	
	}
	function upgrade()
	{		
		window.location=weblink+'upgrade/';		  
	}




/*
 * manage profile delete function call
 */
/*function manage_confirm_box(users_id)
{
	var check=confirm("Are you sure want to delete your profile?");
	
	if(check==true)
	{
		window.location=weblink+"welcome/delete_user_profiles"+ users_id;
	}
	else
	{
		window.location=weblink+"welcome/manage_user_profiles"+ users_id;
	}
}	
*/

/*end of dev code*/
 
function registervalidate()
{
	var id1=document.getElementById('dispname');	
	var id2=document.getElementById('emailid');
	var id3=document.getElementById('password');
	var id4=document.getElementById('cpassword');
	var id6=document.getElementById('captcha');
	var lbl=document.getElementById('errordisplay');
	if(checkTextEmpty(id1,'Display name',lbl) && Name_FirstCharacter_Check(id1,'Display name',lbl) && 
			ifallspaces(id1,'Display name',lbl) && pwdminimum_lengths(id1,'Display name should be atleast 3 characters',3,lbl) && 
			checkTextEmpty(id2,'Email-id',lbl) && 
			validateEmail(id2,'Email-id',lbl) && checkemailexist() && checkTextEmpty(id3,'Password',lbl) && 
			pwdminimum_lengths(id3,'Password should be atleast 8 characters',8,lbl) && 
			checkTextEmpty(id4,'Confirm password',lbl) && comparepasswords(id3,id4,lbl) && 
			pwdminimum_lengths(id4,'Confirm password should be atleast 8 characters',8,lbl) &&
			checkTextEmpty(id6,'Captcha',lbl) && ValidNumber(id6,'Captcha',lbl))
	{
		return true;
	}
		else return false;		
				
}
function validategmail(emid)
{
	var lbl=document.getElementById("errordisplay")
	var email=emid;
	var emstr=email.split("@");//alert("emstr0===>"+emstr[0]);alert("emstr1===>"+emstr[1]);
	xmlHttp.open('GET',weblink+"welcome/emailcheck/"+emstr[0]+"/"+emstr[1]+"", false);
	xmlHttp.send(null); 
	var str=xmlHttp.responseText;
	var str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
	//alert(str);
	if(str=="Exist")
	{
		lbl.innerHTML="Provided email address already exist";
		document.getElementById("emailid").value="";
		return false;
	}
	else 
	{
		lbl.innerHTML=""
		return true;
	}
}
function validateemailid(emid)
{
	var lbl=document.getElementById("errordisplay")
	var email=emid;
	var emstr=email.split("@");//alert("emstr0===>"+emstr[0]);alert("emstr1===>"+emstr[1]);
	xmlHttp.open('GET',weblink+"welcome/emailcheck/"+emstr[0]+"/"+emstr[1]+"", false);
	xmlHttp.send(null); 
	var str=xmlHttp.responseText;
	var str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
	//alert(str);
	if(str=="Exist")
	{
		lbl.innerHTML="Provided email address already exist";
		document.getElementById("email").value="";
		return false;
	}
	else 
	{
		lbl.innerHTML=""
		return true;
	}
}
function validatedomain()
{
	var dom = document.getElementById("domain_name").value;
	var lbl=document.getElementById("errordisplay")
	xmlHttp.open('GET',weblink+"welcome/domaincheck/"+dom, false);
	xmlHttp.send(null); 
	var str=xmlHttp.responseText;
	var str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
	//alert(str);
	if(str=="Exist")
	{
		lbl.innerHTML="Provided domain name already exist";
		document.getElementById("domain_name").value="";
		return false;
	}
	else 
	{
		lbl.innerHTML=""
		return true;
	}
}
function checkemailexist()
{
	var lbl=document.getElementById("errordisplay")
	var email=document.getElementById("emailid").value;
	var emstr=email.split("@");//alert("emstr0===>"+emstr[0]);alert("emstr1===>"+emstr[1]);
	xmlHttp.open('GET',weblink+"welcome/emailcheck/"+emstr[0]+"/"+emstr[1]+"/", false);
	xmlHttp.send(null); 
	var str=xmlHttp.responseText;
	var str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
	if(str=="Exist")
	{
		lbl.innerHTML="Provided email address already exist";
		document.getElementById("emailid").value="";
		return false;
	}
	else 
	{
		lbl.innerHTML=""
		return true;
	}
	
}

function forgetpassword_validate()
{
	var id1=document.getElementById("emailid");
	var lbl=document.getElementById("errordisplay");
	if(newcheckTextEmpty(id1,'Email-Id',lbl) && newvalidateEmail(id1,'Email-Id',lbl) && checkuserexistemail())
	{
		
	}
	else
	{		
			return false;
	}
}
	function restpswd_validate()
	{
		var id1=document.getElementById("newpwd");
		var id2=document.getElementById("confirmpwd");
		var lbl=document.getElementById("errordisplay")
		if(checkTextEmpty(id1,"Password",lbl) && pwdminimum_lengths(id1,'Password should be atleast 8 characters',8,lbl) &&
				checkTextEmpty(id2,"Confirm password",lbl) && pwdminimum_lengths(id2,'Confirm password should be atleast 8 characters',8,lbl)  && comparepasswords(id1,id2,lbl))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	
	function checkuserexistemail()
	{
		var lbl=document.getElementById("errordisplay");
		var uname=document.getElementById("emailid").value;
		xmlHttp.open('GET',weblink+"welcome/checkexistemail/"+Base64.encode(uname), false);	
		xmlHttp.send(null); 
		var str=xmlHttp.responseText;
		var str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
		//alert(str);
		if(str=="norecords")
		{
			lbl.innerHTML="Provided email address doesn't match with our records";
			lbl.setAttribute("class", "errorbackbg");
			document.getElementById("emailid").value="";
			return false;
		}
		else if(str=="notactive")
		{
			lbl.innerHTML="Provided email address match with our records but not activated";
			lbl.setAttribute("class", "errorbackbg");
			document.getElementById("emailid").value="";
			return false;
		}
		else 
		{
			lbl.innerHTML=""
				return true;
		}
	}
	function validatecontact()
	{
		var id1=document.getElementById("cname");
		var id2=document.getElementById("email");
		var id3=document.getElementById("phone");
		var id4=document.getElementById("subject");
		var id5=document.getElementById("message");
		var id6=document.getElementById("captcha");
		var lbl=document.getElementById("valid");
		if(checkTextEmpty(id1,"Name",lbl) && ValidText(id1,"Name",lbl) && ifallspaces(id1,"Name",lbl) && checkTextEmpty(id2,"Email_id",lbl) && validateEmail(id2,"Invalid Email Address",lbl) && checkTextEmpty(id3,"Phone number",lbl) && validateintegers(id3,"Phone number",lbl) && ValidNumber(id3,"Phone number",lbl) && checkTextEmpty(id4,"Subject",lbl)&& ifallspaces(id4,"Subject",lbl) && checkTextEmpty(id5,"Message",lbl) && ifallspaces(id5,"Message",lbl) && checkTextEmpty(id6,'Captcha',lbl) && ValidNumber(id6,"captcha",lbl))
		{
		}
		else
		{
			return false;
		}
	}
	
	function changepassword()
	{
		var id1=document.getElementById("oldpassword");
		var id2=document.getElementById("newpassword");
		var id3=document.getElementById("confirmpassword");
		var lbl=document.getElementById("errordisplay")
		if(checkTextEmpty(id1,"Old password",lbl) && pwdminimum_lengths(id1,'Old password should be atleast 8 characters',8,lbl) && checkoldpwd() && 
				checkTextEmpty(id2,"New password",lbl) && pwdminimum_lengths(id2,'New password should be atleast 8 characters',8,lbl) && nocomparepasswords(id1,id2,lbl) &&
				checkTextEmpty(id3,"Confirm password",lbl) && pwdminimum_lengths(id3,'Confirm password should be atleast 8 characters',8,lbl) && comparepasswords(id2,id3,lbl))
		{
			return true;
		}
		else
		{
			return false;
		}

	}
	
	function checkoldpwd()
	{
		var lbl=document.getElementById("errordisplay")
		var pwes=document.getElementById("oldpassword").value;
		xmlHttp.open('GET',weblink+"welcome/checkoldpwd/"+pwes, false);
		xmlHttp.send(null); 
		var str=xmlHttp.responseText;
		var str=str.replace(/^\s*([\S\s]*)\b\s*$/, '$1');
		if(str=="Not Exist")
		{
			lbl.innerHTML="Old password should not match our records";
			document.getElementById("oldpassword").value="";
			return false;
		}
		else 
		{
			lbl.innerHTML=""
			return true;
		}
		
	}
	
	
//subbu
	
	function validatelistform()
	{
		var id1=document.getElementById("adtitle");
		var id2=document.getElementById("desc");
		var id3=document.getElementById("price");
		var id4=document.getElementById("currency");
		var id5=document.getElementById("laddress1");
		var id6=document.getElementById("lcountry");
		var id7=document.getElementById("lstate");
		var id8=document.getElementById("lcity");
		var id9=document.getElementById("lpincode");
		var id10=document.getElementById("lphoneno");
		var id11=document.getElementById("videourl");
		var id12=document.getElementById("sitebannerimage");
		var id13=document.getElementById("profiledata");
		var lbl=document.getElementById("detailsvalid");
		var lbl1=document.getElementById("addressvalid");
		var lbl2=document.getElementById("videovalid");
		var lbl3=document.getElementById("imagevalid");
		var lbl4=document.getElementById("profilevalid");
		
		if(checkTextEmpty(id1,"Listing title",lbl) && checkTextEmpty(id2,"Listing description",lbl) && minimum_length(id2,"Description should be lessthan 1000 characters ",lbl) && checkTextEmpty(id3,"Price",lbl) && validateintegers(id3,"price",lbl) && checkSelEmpty(id4,"currency",lbl))
		{
		}
		else
		{
			return false;
		}
		if(checkTextEmpty(id5,"Location Address1",lbl1) && checkSelEmpty(id6,"location country",lbl1) && checkSelEmpty(id7,"location state",lbl1) && checkTextEmpty(id8,"lLocation city",lbl1) && checkTextEmpty(id9,"Location pincode",lbl1) && checkTextEmpty(id10,"Location phone",lbl1) && minimum_length1(id10,"Invalid Location Phone",lbl,"8","14") )
		{
		}
		else
		{
			return false;
		}
		if(checkSelEmpty(id13,"profiledata",lbl4))
		{
			
		}
		else
		{
			return false;
		}
		if(id11.value!="")
		{
			
			if(youtubeurlvalidation(id11,"Enter correct youtube url ",lbl2))
			{
			}
			else
			{
				return false;
			} 
		}
		if(checkTextEmpty(id12,"Banner image",lbl3))
		{
		}
		else
		{
			return false;
		}
		
		
	}
	function validatecontform()
	{
		var id1=document.getElementById("usename");
		var id2=document.getElementById("phone");
		var id3=document.getElementById("emaild");
		var id4=document.getElementById("desc");
		var id5=document.getElementById("res");
		var lbl=document.getElementById("valid");
		if(checkTextEmpty(id1,"Username",lbl) && minimum_lengths(id1,"your username must be between 3 and 30 characters long.","3",lbl) && minimum_lengths(id2,"your Phone must be between 8 and 18 characters long.","8",lbl) && checkTextEmpty(id2,"Phone",lbl) && checkTextEmpty(id3,"Emailid",lbl) && validateEmail(id3,"Invalid Email Address",lbl) && checkTextEmpty(id4,"Description",lbl) && minimum_lengths(id4,"your description must be between 3 and 1000 characters long.","3",lbl) && checkTextEmpty(id5,"Captcha",lbl))
		{
		}
		else
		{
			return false;
		}
	}
	function validate_spamfield()
	{
		var id1=document.getElementById("email");
		var id2=document.getElementById("id_reason");
		var id3=document.getElementById("description");
		var lbl=document.getElementById("errortext");
		if(checkTextEmpty(id1,"Email",lbl) && validateEmail(id1,"Invalid Email Address",lbl) && checkSelEmpty(id2,"kind of abuse field",lbl) 
				&& checkTextEmpty(id3,"Description",lbl) && minimum_lengths(id4,"your description must be between 3 and 1000 characters long.","3",lbl) )
		{
		}
		else
		{
			return false;
		}
	}
// Edit Listings
	
	// thmemes
	
	function selected_theme_value(elementname,colorval,adid)
	{
		//alert(elementname);
		var obj = document.getElementById(elementname);
		var val = "#"+colorval;
		obj.style.backgroundColor = val;
		setCookie('text-color',val);
	}
	
	function selected_theme_header_font_color(elementname,colorval,adid)
	{
		//alert(elementname);
		var obj = document.getElementById(elementname);
		var val = "#"+colorval;
		obj.style.color = val;
		setCookie('text-color',val);
	}
	function selected_theme_header_font_size(elementname,colorval,adid)
	{
		//alert(elementname);
		var obj = document.getElementById(elementname);
		var val = colorval;
		//alert(val);
		obj.style.fontSize = val+"px";
		setCookie('text-color',val);
	}
	function selected_theme_header_font_family(elementname,colorval,adid)
	{
		var obj = document.getElementById(elementname);
		var val = colorval;
		//alert(val);
		obj.style.fontFamily = val;
		setCookie('text-color',val);
	}
	function selected_multitheme_header_font_color(elementname,colorval,$adid)
	{
		for(i=1;i<=6;i++)
		{
			var obj = document.getElementById(elementname+[i]);
			//alert(obj);
			var val = "#"+colorval;
			obj.style.color = val;
		}
	}
	function selected_multitheme_header_font_size(elementname,colorval,adid)
	{
		for(i=1;i<=5;i++)
		{
			
			var obj = document.getElementById(elementname+[i]);
			var val = colorval;
			obj.style.fontSize = val+"px";
		}
	}
	function selected_multitheme_header_font_family(elementname,colorval,adid)
	{
		
		for(i=1;i<=5;i++)
		{
			var obj = document.getElementById(elementname+[i]);
			var val = colorval;
			obj.style.fontFamily = val;
		}
	}
	function create_theme_function()
	{
		window.location=weblink+'select-custom-themes';
	}
	function skipthisthemepage()
	{
		window.location=weblink+'display-user-themes';
	}
	function renewplans()
	{
		document.forms["upgradeform"].submit();
	}
	function plans_upgrade1()
	{
		document.forms["upgradeform1"].submit();
	}
	function plans_upgrade2()
	{
		document.forms["upgradeform2"].submit();
	}
	function plans_upgrade3()
	{
		document.forms["upgradeform3"].submit();
	}
	function plans_upgrade4()
	{
		document.forms["upgradeform4"].submit();
	}
	function plans_upgrade5()
	{
		document.forms["upgradeform5"].submit();
	}
	function plans_upgrade6()
	{
		document.forms["upgradeform6"].submit();
	}
	function plans_upgrade7()
	{
		document.forms["upgradeform7"].submit();
	}
	function plans_upgrade8()
	{
		document.forms["upgradeform8"].submit();
	}
	function plans_upgrade9()
	{
		document.forms["upgradeform9"].submit();
	}
	function plans_upgrade10()
	{
		document.forms["upgradeform10"].submit();
	}
	
	function update1()
	{
		document.getElementById("update1").style.display="block";
		document.getElementById("update2").style.display="none";
		document.getElementById("update3").style.display="none";
		document.getElementById("update4").style.display="none";
		document.getElementById("update5").style.display="none";
		document.getElementById("update6").style.display="none";
	}
	function update2()
	{
		document.getElementById("update1").style.display="none";
		document.getElementById("update2").style.display="block";
		document.getElementById("update3").style.display="none";
		document.getElementById("update4").style.display="none";
		document.getElementById("update5").style.display="none";
		document.getElementById("update6").style.display="none";
	}
	function update3()
	{
		document.getElementById("update1").style.display="none";
		document.getElementById("update2").style.display="none";
		document.getElementById("update3").style.display="block";
		document.getElementById("update4").style.display="none";
		document.getElementById("update5").style.display="none";
		document.getElementById("update6").style.display="none";
	}
	function update4()
	{
		document.getElementById("update1").style.display="none";
		document.getElementById("update2").style.display="none";
		document.getElementById("update3").style.display="none";
		document.getElementById("update4").style.display="block";
		document.getElementById("update5").style.display="none";
		document.getElementById("update6").style.display="none";
	}
	function update5()
	{
		document.getElementById("update1").style.display="none";
		document.getElementById("update2").style.display="none";
		document.getElementById("update3").style.display="none";
		document.getElementById("update4").style.display="none";
		document.getElementById("update5").style.display="block";
		document.getElementById("update6").style.display="none";
	}
	function update6()
	{
		document.getElementById("update1").style.display="none";
		document.getElementById("update2").style.display="none";
		document.getElementById("update3").style.display="none";
		document.getElementById("update4").style.display="none";
		document.getElementById("update5").style.display="none";
		document.getElementById("update6").style.display="block";
	}
	function gettheme_domain(values)
	{
		var imgs="<img src='"+weblink +"templates/subdomainthemes/"+values+".png' width='150' height='150'>";
		document.getElementById("themeimage").innerHTML=imgs;
	}
	function features()
	{
		document.getElementById("feature_block").style.display="block";
		document.getElementById("template_block").style.display="none";
		document.getElementById("testimonials_block").style.display="none";
		document.getElementById("feature").className="home_sub_heading_sel";
		document.getElementById("template").className="home_sub_heading";
		document.getElementById("testimonial").className="home_sub_testimonial";
	}
	function templates()
	{
		document.getElementById("feature_block").style.display="none";
		document.getElementById("template_block").style.display="block";
		document.getElementById("testimonials_block").style.display="none";
		document.getElementById("template").className="home_sub_heading_sel";
		document.getElementById("feature").className="home_sub_heading";
		document.getElementById("testimonial").className="home_sub_testimonial";
	}
	function testimonials()
	{
		document.getElementById("feature_block").style.display="none";
		document.getElementById("template_block").style.display="none";
		document.getElementById("testimonials_block").style.display="block";
		document.getElementById("testimonial").className="home_sub_testimonial_sel";
		document.getElementById("template").className="home_sub_heading";
		document.getElementById("feature").className="home_sub_heading";
	}
	function defaultextonclick()
	{
		var id1=document.getElementById('name').value;
		if(id1='City, State (or) Zip Code')
		{
		document.getElementById('name').fontColor ="#dadada";
		document.getElementById('name').value="";
		}
	}
	function defaultextonclicks()
	{
		var id1=document.getElementById('name').value;
		if(id1='City, State (or) Zip Code')
		{
		document.getElementById('name').className="header_search_textbox";
		}
	}
	function cat1()
	{
		document.getElementById("residen_block").style.display="none";
		document.getElementById("jobs_block").style.display="block";
		document.getElementById("comm_block").style.display="none";
		document.getElementById("autos_block").style.display="none";
		document.getElementById("service_block").style.display="none";
		document.getElementById("buy_sell_block").style.display="none";
		document.getElementById("pets_block").style.display="none";
		document.getElementById("other_block").style.display="none";
		document.getElementById("electronic_block").style.display="none";
		document.getElementById("food_block").style.display="none";
		document.getElementById("1").className="newlisting_items_sel";
		document.getElementById("2").className="newlisting_items";
		document.getElementById("3").className="newlisting_items";
		document.getElementById("4").className="newlisting_items";
		document.getElementById("5").className="newlisting_items";
		document.getElementById("6").className="newlisting_items";
		document.getElementById("7").className="newlisting_items";
		document.getElementById("8").className="newlisting_items";
		document.getElementById("60").className="newlisting_items";
		document.getElementById("61").className="newlisting_items";
		
	}
	function cat2()
	{
		document.getElementById("residen_block").style.display="block";
		document.getElementById("jobs_block").style.display="none";
		document.getElementById("comm_block").style.display="none";
		document.getElementById("autos_block").style.display="none";
		document.getElementById("service_block").style.display="none";
		document.getElementById("buy_sell_block").style.display="none";
		document.getElementById("pets_block").style.display="none";
		document.getElementById("other_block").style.display="none";
		document.getElementById("electronic_block").style.display="none";
		document.getElementById("food_block").style.display="none";
		document.getElementById("1").className="newlisting_items";
		document.getElementById("2").className="newlisting_items_sel";
		document.getElementById("3").className="newlisting_items";
		document.getElementById("4").className="newlisting_items";
		document.getElementById("5").className="newlisting_items";
		document.getElementById("6").className="newlisting_items";
		document.getElementById("7").className="newlisting_items";
		document.getElementById("8").className="newlisting_items";
		document.getElementById("60").className="newlisting_items";
		document.getElementById("61").className="newlisting_items";
	}
	function cat3()
	{
		document.getElementById("residen_block").style.display="none";
		document.getElementById("jobs_block").style.display="none";
		document.getElementById("comm_block").style.display="block";
		document.getElementById("autos_block").style.display="none";
		document.getElementById("service_block").style.display="none";
		document.getElementById("buy_sell_block").style.display="none";
		document.getElementById("pets_block").style.display="none";
		document.getElementById("other_block").style.display="none";
		document.getElementById("electronic_block").style.display="none";
		document.getElementById("food_block").style.display="none";
		document.getElementById("1").className="newlisting_items";
		document.getElementById("2").className="newlisting_items";
		document.getElementById("3").className="newlisting_items_sel";
		document.getElementById("4").className="newlisting_items";
		document.getElementById("5").className="newlisting_items";
		document.getElementById("6").className="newlisting_items";
		document.getElementById("7").className="newlisting_items";
		document.getElementById("8").className="newlisting_items";
		document.getElementById("60").className="newlisting_items";
		document.getElementById("61").className="newlisting_items";
	}
	function cat4()
	{
		document.getElementById("residen_block").style.display="none";
		document.getElementById("jobs_block").style.display="none";
		document.getElementById("comm_block").style.display="none";
		document.getElementById("autos_block").style.display="block";
		document.getElementById("service_block").style.display="none";
		document.getElementById("buy_sell_block").style.display="none";
		document.getElementById("pets_block").style.display="none";
		document.getElementById("other_block").style.display="none";
		document.getElementById("electronic_block").style.display="none";
		document.getElementById("food_block").style.display="none";
		document.getElementById("1").className="newlisting_items";
		document.getElementById("2").className="newlisting_items";
		document.getElementById("3").className="newlisting_items";
		document.getElementById("4").className="newlisting_items_sel";
		document.getElementById("5").className="newlisting_items";
		document.getElementById("6").className="newlisting_items";
		document.getElementById("7").className="newlisting_items";
		document.getElementById("8").className="newlisting_items";
		document.getElementById("60").className="newlisting_items";
		document.getElementById("61").className="newlisting_items";
	}
	function cat5()
	{
		document.getElementById("residen_block").style.display="none";
		document.getElementById("jobs_block").style.display="none";
		document.getElementById("comm_block").style.display="none";
		document.getElementById("autos_block").style.display="none";
		document.getElementById("service_block").style.display="block";
		document.getElementById("buy_sell_block").style.display="none";
		document.getElementById("pets_block").style.display="none";
		document.getElementById("other_block").style.display="none";
		document.getElementById("electronic_block").style.display="none";
		document.getElementById("food_block").style.display="none";
		document.getElementById("1").className="newlisting_items";
		document.getElementById("2").className="newlisting_items";
		document.getElementById("3").className="newlisting_items";
		document.getElementById("4").className="newlisting_items";
		document.getElementById("5").className="newlisting_items_sel";
		document.getElementById("6").className="newlisting_items";
		document.getElementById("7").className="newlisting_items";
		document.getElementById("8").className="newlisting_items";
		document.getElementById("60").className="newlisting_items";
		document.getElementById("61").className="newlisting_items";
	}
	function cat6()
	{
		document.getElementById("residen_block").style.display="none";
		document.getElementById("jobs_block").style.display="none";
		document.getElementById("comm_block").style.display="none";
		document.getElementById("autos_block").style.display="none";
		document.getElementById("service_block").style.display="none";
		document.getElementById("buy_sell_block").style.display="block";
		document.getElementById("pets_block").style.display="none";
		document.getElementById("other_block").style.display="none";
		document.getElementById("electronic_block").style.display="none";
		document.getElementById("food_block").style.display="none";
		document.getElementById("1").className="newlisting_items";
		document.getElementById("2").className="newlisting_items";
		document.getElementById("3").className="newlisting_items";
		document.getElementById("4").className="newlisting_items";
		document.getElementById("5").className="newlisting_items";
		document.getElementById("6").className="newlisting_items_sel";
		document.getElementById("7").className="newlisting_items";
		document.getElementById("8").className="newlisting_items";
		document.getElementById("60").className="newlisting_items";
		document.getElementById("61").className="newlisting_items";
	}
	function cat7()
	{
		document.getElementById("residen_block").style.display="none";
		document.getElementById("jobs_block").style.display="none";
		document.getElementById("comm_block").style.display="none";
		document.getElementById("autos_block").style.display="none";
		document.getElementById("service_block").style.display="none";
		document.getElementById("buy_sell_block").style.display="none";
		document.getElementById("pets_block").style.display="block";
		document.getElementById("other_block").style.display="none";
		document.getElementById("electronic_block").style.display="none";
		document.getElementById("food_block").style.display="none";
		document.getElementById("1").className="newlisting_items";
		document.getElementById("2").className="newlisting_items";
		document.getElementById("3").className="newlisting_items";
		document.getElementById("4").className="newlisting_items";
		document.getElementById("5").className="newlisting_items";
		document.getElementById("6").className="newlisting_items";
		document.getElementById("7").className="newlisting_items";
		document.getElementById("8").className="newlisting_items_sel";
		document.getElementById("60").className="newlisting_items";
		document.getElementById("61").className="newlisting_items";
	}
	function cat8()
	{
		document.getElementById("residen_block").style.display="none";
		document.getElementById("jobs_block").style.display="none";
		document.getElementById("comm_block").style.display="none";
		document.getElementById("autos_block").style.display="none";
		document.getElementById("service_block").style.display="none";
		document.getElementById("buy_sell_block").style.display="none";
		document.getElementById("pets_block").style.display="none";
		document.getElementById("other_block").style.display="block";
		document.getElementById("electronic_block").style.display="none";
		document.getElementById("food_block").style.display="none";
		document.getElementById("1").className="newlisting_items";
		document.getElementById("2").className="newlisting_items";
		document.getElementById("3").className="newlisting_items";
		document.getElementById("4").className="newlisting_items";
		document.getElementById("5").className="newlisting_items";
		document.getElementById("6").className="newlisting_items";
		document.getElementById("7").className="newlisting_items";
		document.getElementById("8").className="newlisting_items_sel";
		document.getElementById("60").className="newlisting_items";
		document.getElementById("61").className="newlisting_items";
	}
	function cat60()
	{
		document.getElementById("residen_block").style.display="none";
		document.getElementById("jobs_block").style.display="none";
		document.getElementById("comm_block").style.display="none";
		document.getElementById("autos_block").style.display="none";
		document.getElementById("service_block").style.display="none";
		document.getElementById("buy_sell_block").style.display="none";
		document.getElementById("pets_block").style.display="none";
		document.getElementById("other_block").style.display="none";
		document.getElementById("electronic_block").style.display="block";
		document.getElementById("food_block").style.display="none";
		document.getElementById("1").className="newlisting_items";
		document.getElementById("2").className="newlisting_items";
		document.getElementById("3").className="newlisting_items";
		document.getElementById("4").className="newlisting_items";
		document.getElementById("5").className="newlisting_items";
		document.getElementById("6").className="newlisting_items";
		document.getElementById("7").className="newlisting_items";
		document.getElementById("8").className="newlisting_items";
		document.getElementById("60").className="newlisting_items_sel";
		document.getElementById("61").className="newlisting_items";
	}
	function cat61()
	{
		document.getElementById("residen_block").style.display="none";
		document.getElementById("jobs_block").style.display="none";
		document.getElementById("comm_block").style.display="none";
		document.getElementById("autos_block").style.display="none";
		document.getElementById("service_block").style.display="none";
		document.getElementById("buy_sell_block").style.display="none";
		document.getElementById("pets_block").style.display="none";
		document.getElementById("other_block").style.display="none";
		document.getElementById("electronic_block").style.display="none";
		document.getElementById("food_block").style.display="block";
		document.getElementById("1").className="newlisting_items";
		document.getElementById("2").className="newlisting_items";
		document.getElementById("3").className="newlisting_items";
		document.getElementById("4").className="newlisting_items";
		document.getElementById("5").className="newlisting_items";
		document.getElementById("6").className="newlisting_items";
		document.getElementById("7").className="newlisting_items";
		document.getElementById("8").className="newlisting_items";
		document.getElementById("60").className="newlisting_items";
		document.getElementById("61").className="newlisting_items_sel";
	}

