function echeckinvite(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Geçerli bir e-mail adresi giriniz")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Geçerli bir e-mail adresi giriniz")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Geçerli bir e-mail adresi giriniz")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Geçerli bir e-mail adresi giriniz")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Geçerli bir e-mail adresi giriniz")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Geçerli bir e-mail adresi giriniz")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Geçerli bir e-mail adresi giriniz")
		    return false
		 }
         
		$("#invitest").load("/_inc/_invite_action.php", {action:'inviteme', email_invite:  document.getElementById("email_invite").value });

	    document.getElementById("email_invite").value="";
		
 		 return true	
		 
	     
	}
	
	
	
	
	function mainsearchsubmit(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

   
if (keycode == 13)
   {
      
   msearch()
   return false;
   }
else
   return true;
}




function loadnewmessages() {
	
	$("#tipboxxx").load("/_inc/_checknots.php" , {action: "kutu" },function(){ setTimeout('loadnewmessages()', 120000);  })
	
}



function showAlert(message, stk) {
	
	$.jGrowl(message, { 
					sticky: stk,
					 life: 4000,
					closer: false
				});
	
	}




function showlayer(layer){
var myLayer = document.getElementById(layer);
if(myLayer.style.display=="none" || myLayer.style.display==""){
myLayer.style.display="block";
} else {
myLayer.style.display="none";
}
}






function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
}

function validateEmail(fld) {
    var error="";
    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
   
    if (fld.value == "") {
        fld.style.background = 'Yellow';
        error = "You didn't enter an email address.\n";
    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
        fld.style.background = 'Yellow';
        error = "Please enter a valid email address.\n";
    } else if (fld.value.match(illegalChars)) {
        fld.style.background = 'Yellow';
        error = "The email address contains illegal characters.\n";
    } else {
        fld.style.background = 'White';
    }
    return error;
} 
	
	

/*******************************   AKTIVITE   ***********************************/

function navigategoster(act, dy, mn, yr, tipi, gstr, efekt, sayfa) {
	
if (efekt == 1) {
	
  $("#calendar").fadeTo(100, 0, function(){
   $("#calendar").load("/events/_calendar.php" , {action: act , day: dy, month: mn, year: yr, tip: tipi, goster: gstr, page: sayfa },function(){ $("#calendar").fadeTo(100, 1);}); 
   
   });
 

}else{
	$("#calendar").load("/events/_calendar.php" , {action: act , day: dy, month: mn, year: yr, tip: tipi, goster: gstr, page: sayfa }); 
	
	}
	
   

}






/*******************************   MENU DEGISIMI   ***********************************/



function justgo(soyle){
window.location=soyle
return true
}






function menuchange (the,mname, nname) {
 $("."+mname).removeClass(mname).addClass(nname);
 $(the).removeClass(nname).addClass(mname);
}
 
function menuchangephoto (the,mname, nname) {
 $j("."+mname).removeClass(mname).addClass(nname);
 $j(the).removeClass(nname).addClass(mname);
}
 






/*******************************   FRIEND FINDER   ***********************************/








/*******************************   GORSEL SANATLAR   ***********************************/


function showportnext(mem,vid) {

$('#portcontent'+mem).load('/visual-arts/_indexport.php',{action:'portfolio', members: mem,vid: vid})

}



function showmeprofilephoto( mids, sections, typo, adets, pages, edit, head) {

$j("#portfolyo-container").load("/users/ajax/portfolyo.php", { mid: mids, section: sections , type: typo, adet: adets, page:pages, edit:edit, header:head }, function(){
$j("#loadingportfolyo").hide() 
$j("#portfolyo-container").show()
});

}



function makeprofile(img_id) {

$j.post("/users/_actionman.php",
        
		{action: "makeprofileimage", img_id:img_id},
		function(){
          
		alert("Profil resminiz değiştirildi")
        }); 

}


function delimage(img_id) {

if (confirm("Fotoğrafı silmek istediğinize emin misiniz?")){
$j.post("/users/_actionman.php",
        
		{action: "delimage", img_id:img_id},
		function(){
          
		 $j(".img"+img_id).remove() 
				
        }); 	

}
	
}


 


function showmeprofile( mids, sections, typo, adets, pages, edit, head) {

$("#portfolyo-container").load("/users/ajax/portfolyo.php", { mid: mids, section: sections , type: typo, adet: adets, page:pages, edit:edit, header:head }, function(){
$("#loadingportfolyo").hide() 
$("#portfolyo-container").show()

});

}



function showallusers(page) {
	

$("#users-container").load("/users/ajax/_allusers.php", { color: $('#color:checked').val() , view: view, sira: siram, artist: $('#people').val(), job: $('#job').val(), sch:$('#university').val(), dep:$('#department').val(), page:page });

}


function showimage(mid,members, edit){
	
$("#photo-content").load("/users/ajax/imgshow.php", { mid: mid, members:members, edit:edit});

showme(20,mid,20,0,0,1,0);

fotoid=mid

}

function showeventsimage(mid,members, edit){
	
$("#photo-content").load("/events/_imgshow.php", { mid: mid, members:members, edit:edit});

showme(20,mid,20,0,0,1,0);

fotoid=mid

}



function showmyfriends( mid, adet, page) {

$("#arkadas-container ol").load("/users/ajax/myfriends.php", { mid: mid, adet: adet, page:page });

}


function showmeorder( mids, sections, typo, adets, pages) {

$("#portfolyo-container").load("/users/ajax/ordering.php", { mid: mids, section: sections , type: typo, adet: adets, page:pages }, function(){
$("#loadingportfolyo").hide() 
$("#portfolyo-container").show()
});

}




function showmevisual( typo, adets, pages) {

$("#visual-container").load("/_inc/ajax/visual.php", { type: typo, adet: adets, page:pages })

}






function checkmsg(id) {
 
$("#msg-temp").load("/users/ajax/_checkmsg.js.php", { id:id },function(){
																				  																		  
setTimeout("checkmsg("+id+")",20000)

});



}


function showinbox(id,sections, adets, pages, sirala) {

$("#msg-loader").load("/users/ajax/_inbox.js.php", { section: sections , id:id, adet: adets, page:pages, siralama:sirala});

}





function msgreply(action, msg_id, member, sender, msg){	
	


	$.post("/users/_actionman.php",{action:action, msg_id:msg_id, member:member, sender:sender ,msg:msg}, function(){
          
		  $('#yorumfield').val("")
		 showinbox(msg_id,2, 15, 1, 1)
		 //showme(sections, id, sections, 0, 0, page, 0, siralama) 
				
        }); 	 

}		






function showme(div, mids, sections, typo, adets, pages, head, sirala) {

if (div == 10 ) {
var divim = "#arkadas-container ol";	
	
}

if (div == 12 ) {
var divim = "#alluser-container ol";	
	
}



if (div == 13 || div == 11 || div == 14 || div == 15 || div == 16 || div == 17 || div == 18 || div == 19 || div == 20) {
var divim = "#yorum-container ol";	
var adets = 15; /* SITENIN DEFAULT YORUM ADEDINI BELIRLE*/
}




$(divim).load("/_inc/ajax/general.php", { div : div, mid: mids, section: sections , type: typo, adet: adets, page:pages, header:head, siralama:sirala});

}












function simdikidel(action,id){


if(confirm('Silmek istediğinizden emin misiniz?')) {
	
	
	$.post("/simdikizaman/_actionman.php",
        
		{action: action, id:id},
		function(){
          
		 $(".y"+id).remove() 
		 //showme(sections, id, sections, 0, 0, page, 0, siralama) 
				
        }); 	
	
}
	
}



function submityorum(sectiona, id, yazar_id, icerik, sections, page, siralama, silme, commentid,prof){

if ( silme == 1) {
	
	

if(confirm('Silmek istediğinizden emin misiniz?')) {
	
	
	$.post("/_inc/actions/yorum_action.php",
        
		{section: sectiona, mid:id, sil:silme, cid:commentid},
		function(){
          
		 $(".y"+commentid).remove() 
		 //showme(sections, id, sections, 0, 0, page, 0, siralama) 
				
        }); 	 
	
	
}
	
	} else {



var yorumfields = document.getElementById("yorumfield");

if(yorumfields.value==""){
    	alert("Lütfen yorum yazınız");
        yorumfields.focus();
        return false;
     }else{
	 
	 
	$.post("/_inc/actions/yorum_action.php",
        
		{section: sectiona, mid:id, yid : yazar_id, yorum: icerik},
		function(){
           
		  if (prof){
		var cek = yazar_id;
		  }else{
			var cek = id;  
			  }
		 showme(sections, cek, sections, 0, 0, page, 0, siralama) 
			
				yorumfields.value = "";
        }); 	 
	 
	
	 }
	 
	}
}		








/*******************************   TIPIK MAGAZIN   ***********************************/

function fadehaber(divim,  kod, turn, kapat){
var kod = kod 
	
var kod2 = kod+1
if (kod2 > 2) {
	kod2=0;
}

if ( kod < 1 ) {
kods = 2	
}else{
kods = kod-1	
}


if ( turn=="fade") {
$(divim+kods).hide()
$(divim+kod).show()


	

timer = setTimeout("fadehaber('"+divim+"',"+kod2+",'fade')",8000);  
	}else{
$(divim+kapat).hide()
$(divim+kod).show()


	
		
		
	}
	
	
	
	

}







/*******************************   RATING   ***********************************/



 function rating_func(raters, id, rname, ncount)
{


$(rname).load("/_inc/rating/rating.php",{ rater: raters, j: ncount, q: id });


}






/*******************************   FAVORILER   ***********************************/

function contactac(a, id) {
	
	if (a=="ok"){

   $.post("/users/_actionman.php", {action : "addcontact", id : id});
				
	}
	
	if (a=="del") {
	
   $.post("/users/_actionman.php", {action : "delcontact", id : id});
		
	}
	
	}
	
	
	

function contactdel(id) {
	

if(confirm("kontak listenizden silmek istediğinize emin misiniz?")) {
   $.post("/users/_actionman.php", {action : "delcontact", id : id}, function () {
																			   
     $("#contactreq").load("/_ajax_favoriler.php", {action : "profile", ids : id});																		   
																			   
	});
		
}
	
	}
	
	

function addcontact(act, id) {
	
	if(confirm("kontak listenize eklemek istediğinize emin misiniz?")) {

    $.post("/users/_actionman.php", {action : "tryaddcontact", id : id}, function () {
																			   
     $("#contactreq").load("/_ajax_favoriler.php", {action : "profile", ids : id});																		   
																			   
	});
				
	}
	}
	
/*******************************   FAVORILER   ***********************************/


function addwlist(type,act, id) {
		
$.post("/_inc/_wlistaction.php", {req:"wlist", type:type, action : act, id : id}, function () {
																			   
   $("#wlist"+id).load("/_ajax_favoriler.php", {action : type, ids : id});
	
	
	});
				
	
	}
	
	
	
	
	function flagit(type,act, id) {
		
		if(confirm("Uygun olmayan içeriği rapor etmek istediğinize emin misiniz?")) {
			
$.post("/_inc/_wlistaction.php", {req:"flag", type:type, action : act, id : id}, function () {
																			   
   $("#wlist1"+id).load("/_ajax_favoriler.php", {action : type, req:"flag", ids : id});
	
	
	});
	
	}
				
	
	}
	
	
