var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid){

var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false

page_request.onreadystatechange=function(){

    
$('#profileright').html('<p><img src="images/loadgif.gif" border=0></p>').css({"align":"center"});
loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}

function loadpage(page_request, containerid){

if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}


function photo(url, containerid){

var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false

page_request.onreadystatechange=function(){

    
$('#profileright').html('<div style="padding-top:10px;" align="center"><p><img src="images/loadgif.gif" border=0></p></div>').css({"align":"center"});
loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}

function loadpage(page_request, containerid){

if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}




   function signup(user_type,email,password1,fname,com_name,add,city,state,country,zip,phone,fax){
	   

	var user_type=$('#'+user_type).val();
	var email=$('#'+email).val();
	var password1=$('#'+password1).val();
	var fname=$('#'+fname).val();
	var com_name=$('#'+com_name).val();
	var add=$('#'+add).val();
	var city=$('#'+city).val();
	var state=$('#'+state).val();
	var country=$('#'+country).val();
	var zip=$('#'+zip).val();
	var phone=$('#'+phone).val();
	var fax=$('#'+fax).val();
	
	
	var invalid = " "; // Invalid character is a space
var minLength = 0; // Minimum length
var email1 = document.signupform.email.value;
var fname1 = document.signupform.fname.value;
var password2 = document.signupform.password1.value;
var com_name1 = document.signupform.com_name.value;
var city1 = document.signupform.city.value;
var state1 = document.signupform.state.value;
var country1 = document.signupform.country.value;





if (document.signupform.box.email == "") {
alert('Please enter Valid Email');
return false;
}


else {
if (document.signupform.fname1.value == "") {
alert('Please enter your name');
return false;
}

if (document.signupform.password2.value == "") {
alert('Please enter your password');
return false;
}

if (document.signupform.com_name1.value == "") {
alert('Please enter company name');
return false;
}

if (document.signupform.city1.value == "") {
alert('Please enter city');
return false;
}

if (document.signupform.state1.value == "") {
alert('Please enter state');
return false;
}

if (document.signupform.country1.value == "0") {
alert('Please select country');
return false;
}


}


	
			


		
			
	$("#register").ajaxStart(function(){	
 $('#register').html("Please Wait <br> <img src='images/loadgif.gif' border=0>");
 });


                        $.ajax(
						{
						url: 'signpaction.php',
						type: 'POST',
						data: 'user_type='+user_type+'&email='+email+'&password='+password1+'&fname='+fname+'&com_name='+com_name+'&add='+add+'&city='+city+'&state='+state+'&country='+country+'&zip='+zip+'&phone='+phone+'&fax='+fax,
						success: function(result) 
						
						{
					
							  
							$('#register').load('confurm.php?email='+email);	
							
								//$('#paginatdiv').load('pagination.php?pagesize='+limit+'&total_rows='+total_rows);	
								
						}
					}
				);
					

		return false;
		

 }
 
 
 
 
    function editprofile(user_type,name,com_name,address,city,state,country,zip,phone,fax,services,website){


	var user_type=$('#'+user_type).val();
	var name=$('#'+name).val();
	var com_name=$('#'+com_name).val();
	var address=$('#'+address).val();
	var city=$('#'+city).val();
	var state=$('#'+state).val();
	var country=$('#'+country).val();
	var zip=$('#'+zip).val();
	var phone=$('#'+phone).val();
	var fax=$('#'+fax).val();
	var services=$('#'+services).val();
		var website=$('#'+website).val();
	
		$("#loading").ajaxStart(function(){	
 $('#loading').html("<img src='images/38.gif' border=0>");
 });
		


                        $.ajax(
						{
						url: 'profile_action.php',
						type: 'POST',
						data: 'user_type='+user_type+'&name='+name+'&com_name='+com_name+'&address='+address+'&city='+city+'&state='+state+'&country='+country+'&zip='+zip+'&phone='+phone+'&fax='+fax+'&services='+services+'&website='+website,
						success: function(result) 
						
						{
					
							  
							$('#profileview').load('profileview.php');	
							
								//$('#paginatdiv').load('pagination.php?pagesize='+limit+'&total_rows='+total_rows);	
								
						}
					}
				);
					

		return false;
		

 }

 
 
 function toggle() {
	var ele = document.getElementById("toggleText");
	var text = document.getElementById("displayText");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "Take a Picture";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "Take a Picture";
	}
} 



 function imgval(){

if(this.upimage.value == '') {
    alert('Please select picture');
    this.upimage.focus();
   
  }	
 return false;
 }





function openpage1(id){
var id=$('#'+id).val();

{
$('#right').load('profileinner.php?id='+id);
$('#profile_left').load('profile_left.php?id='+id);
}
		return false;
 }


function openpage2(id){
var id=$('#'+id).val();

{
$('#right').load('my_ads.php?id='+id);
$('#profile_left').load('profile_left.php?id='+id);

}
		return false;
 }
 
 
 
function openpage3(id){
var id=$('#'+id).val();

{
$('#right').load('my_messages.php?id='+id);
$('#profile_left').load('profile_left.php?id='+id);

}
		return false;
 }
 
 
 
function openpage4(id){
var id=$('#'+id).val();

{
$('#right').load('settings.php?id='+id);
$('#profile_left').load('profile_left.php?id='+id);

}
		return false;
 }
 
 
 


function validatePwd() {
var invalid = " "; // Invalid character is a space
var minLength = 6; // Minimum length
var pw1 = document.myForm.password.value;
var pw2 = document.myForm.password2.value;
var pw3 = document.myForm.password3.value;
// check for a value in both fields.
if (pw1 == '' || pw2 == '') {
alert('Please enter your old password');
return false;
}
// check for minimum length
if (document.myForm.password.value.length < minLength) {
alert('Your password must be at least ' + minLength + ' characters long. Try again.');
return false;
}
// check for spaces
if (document.myForm.password.value.indexOf(invalid) > -1) {
alert("Sorry, spaces are not allowed.");
return false;
}
else {
if (pw1 != pw2) {
alert ("You did not enter the same old password. Please re-enter your password.");
return false;
}
else {
if (document.myForm.password3.value.length < minLength) {
alert('Your new password must be at least ' + minLength + ' characters long. Try again.');
return false;
      }
	  {
		  
		  $('#chnagepassword').load('changepassmessage.php');	
		  
		  
		  }
	  
	  
	  
      }
   }
}


function addads(){

{
$('#right').load('addads.php');

}
		return false;
 }


function postads() {
var invalid = " "; // Invalid character is a space
var minLength = 0; // Minimum length
var type = document.myForm.user_type.value;
var subject = document.myForm.subject.value;
var detail = document.myForm.detail.value;



if (document.myForm.user_type.value == "0") {
alert('Please select Category.');
return false;
}


else {
if (document.myForm.subject.value == "") {
alert('Please enter your Subject.');
return false;
}

else {
if (document.myForm.detail.value == "") {
alert('Please enter your Description.');
return false;
}
	  {
		  
		  $('#right').load('morepost.php?action='+minLength);	
		  
		  
		  }
	  
	  
	  
      }
   }
}


function managepost(id){
var id=$('#'+id).val();

{
$('#right').load('managepost.php?id='+id);

}
		return false;
 }






   function editpost(user_type,subject,detail,status1,id){
	   

	var user_type=$('#'+user_type).val();
	var subject=$('#'+subject).val();
	var detail=$('#'+detail).val();
	var status1=$('#'+status1).val();
	var id=$('#'+id).val();
	var minLength = 1;


		
			
	$("#loading").ajaxStart(function(){	
 $('#loading').html("<img src='images/38.gif' border=0>");
 });


                        $.ajax(
						{
						url: 'editpostaction.php',
						type: 'POST',
						data: 'user_type='+user_type+'&subject='+subject+'&detail='+detail+'&status1='+status1+'&id='+id,
						success: function(result) 
						
						{
					
							  
							$('#right').load('my_ads.php?action='+minLength);	
							
								//$('#paginatdiv').load('pagination.php?pagesize='+limit+'&total_rows='+total_rows);	
								
						}
					}
				);
					

		return false;
		

 }




function delpostalert(id){
var id=$('#'+id).val();

{
$('#right').load('postdelalert.php?id='+id);

}
		return false;
 }


function delpost(id){
var id=$('#'+id).val();
var minLength = 2;



 $.ajax(
						{
						url: 'delpost.php',
						type: 'POST',
						data: 'id='+id,
						success: function(result) 

{
$('#right').load('my_ads.php?action='+minLength);

}

	}
				);
 
		return false;
 }








function ealert(ealert1){
var ealert1=$('#'+ealert1).val();
var minLength = 1;



 $.ajax(
						{
						url: 'ealert.php',
						type: 'POST',
						data: 'ealert1='+ealert1,
						success: function(result) 

{
$('#right').load('settings.php?action='+minLength);

}

	}
				);
 
		return false;
 }





function emailAlert() {
var invalid = " "; // Invalid character is a space
var minLength = 0; // Minimum length
var emailal = document.myalert.emailal.value;




if (document.myalert.emailal.value == "") {
alert('Please enter your valid Email');
return false;
}


else {
if (document.myalert.emailal.value == "Email Alert") {
alert('Please enter your valid Email.');
return false;
}



{
		 
		  $('#bodyright').load('confurmalert.php?email='+emailal);	
		  //$('#paginatdiv').load('pagination.php?pagesize='+limit+'&total_rows='+total_rows);	
}
}
}


function make_blank()
{
document.myalert.emailal.value ="";
}




function reply(detail,postid,catid,mainuser) {
var invalid = " "; // Invalid character is a space
var minLength = 0; // Minimum length
var emailal = document.postreply.detail.value;
var detail=$('#'+detail).val();
var postid=$('#'+postid).val();
var catid=$('#'+catid).val();
var mainuser=$('#'+mainuser).val();




if (document.postreply.detail.value == "") {
alert('Please enter Post Reply detail');
return false;
}



 $.ajax(
						{
						url: 'postreplyaction.php',
						type: 'POST',
						data: 'detail='+detail+'&postid='+postid+'&catid='+catid+'&mainuser='+mainuser,
						success: function(result) 



{
		 
		  
		  document.postreply.detail.value ="";
		  
		  $('#replyposted').load('replyinner.php?postid='+postid);	

		  
		  

		  //$('#paginatdiv').load('pagination.php?pagesize='+limit+'&total_rows='+total_rows);	

}
})
}





function msg1(title,msg,mainuser) {
var invalid = " "; // Invalid character is a space
var minLength = 0; // Minimum length
var title = document.sendmsg.title.value;
var msg = document.sendmsg.msg.value;

var title=$('#'+title).val();
var msg=$('#'+msg).val();
var mainuser=$('#'+mainuser).val();





if (document.sendmsg.title.value == "") {
alert('Please enter Subject');
return false;
}



 $.ajax(
						{
						url: 'sendmsgaction.php',
						type: 'POST',
						data: 'title='+title+'&msg='+msg+'&mainuser='+mainuser,
						success: function(result) 



{
		 
		  
		 	  
		  $('#msgaria').load('msgsend.php?mainuser='+mainuser);	

		  
		  

		  //$('#paginatdiv').load('pagination.php?pagesize='+limit+'&total_rows='+total_rows);	

}
})
}




function msg2() {
var invalid = " "; // Invalid character is a space
var minLength = 0; // Minimum length
var title = document.sendmsg.title.value;
var msgdet = document.sendmsg.msgdet.value;




if (document.sendmsg.title.value == "") {
alert('Please enter Subject');
return false;
}


else {
if (document.sendmsg.msgdet.value == "") {
alert('Please enter Message details');
return false;
}



{
		 
		  $('#msgaria').load('msgsend.php');	
		  
}




}
}








   function delreply(postid,comid){
	   

	var id=$('#'+id).val();
	var postid=$('#'+postid).val();

		$("#replyposted").ajaxStart(function(){	
 $('#replyposted').html("<img src='images/38.gif' border=0>");
 });
		


                        $.ajax(
						{
						url: 'delreply.php',
						type: 'POST',
						data: 'id='+comid,
						success: function(result) 
						
						{
					
							  
							  $('#replyposted').load('user_view_comment.php?id='+comid+'&postid='+postid);	
							
								//$('#paginatdiv').load('pagination.php?pagesize='+limit+'&total_rows='+total_rows);	
								
						}
					}
				);
					

		return false;
		

 }



function searchresult() {
var invalid = " "; // Invalid character is a space
var minLength = 0; // Minimum length
var box = document.mysearch.box.value;





if (document.mysearch.box.value == "") {
alert('Please enter Search keyword');
return false;
}


else {
if (document.mysearch.box.value == "Search") {
alert('Please enter Search keyword "Search" is not a keyword.');
return false;
}


}
}

function searchmake_blank()
{
document.mysearch.box.value ="";
}





function viewmsg(id){
var id=$('#'+id).val();

{
$('#right').load('viewmsg.php?id='+id);

}
		return false;
 }


function msgsent(){
var id=$('#'+id).val();
var minLength = 1; // Minimum length


{
$('#right').load('my_messages.php?id='+minLength);

}
		return false;
 }

 function openpage5(id){
var id=$('#'+id).val();

{
$('#right').load('my_web_page.php?id='+id);
$('#profile_left').load('profile_left.php?id='+id);

}
		return false;
 }
 
 
 
 
 
 function findname(){

{
$('#right').load('find_name.php');

}
		return false;
 }





function minchat(id) {
	
var id=$('#'+id).val();	
		
	    $.ajax(
						{
						url: 'chat_win_pose.php',
						type: 'POST',
						data: 'id='+id,
						success: function(result) 
						
						{
					
							  
								var ele = document.getElementById("chatbody1");
	
	if(ele.style.display == "none") {
    		ele.style.display = "block";
		
  	}
	else {
		ele.style.display = "none";
		
	}
								
						}
					}
				);
					
	
}






/*function minchat(id) {
	
	
	
	
	var ele = document.getElementById("chatbody1");
	
	if(ele.style.display == "none") {
    		ele.style.display = "block";
		
  	}
	else {
		ele.style.display = "none";
		
	}
	
	
	var minLength = 1;
	
	    $.ajax(
						{
						url: 'chat_win_pose.php',
						type: 'POST',
						data: 'id='+minLength,
						success: function(result) 
						
						{
					
							  
								//$('#paginatdiv').load('pagination.php?pagesize='+limit+'&total_rows='+total_rows);	
								
						}
					}
				);
					
	
} */

 function login32() {
	var ele2 = document.getElementById("toggleText23");
	var ele = document.getElementById("toggleText22");
	var text = document.getElementById("displayText22");
	if(ele.style.display == "block") {
    		ele2.style.display = "none";
			ele.style.display = "none";
		text.innerHTML = "Take a Picture";
  	}
	else {
		
		ele2.style.display = "block";
		ele.style.display = "block";
		text.innerHTML = "Take a Picture";
	}
} 








