	 var SaveHtml='';
  	 
  	 
  	 function PageConstructor(Mpage)
		 	 {

		 	
		 	 	$.ajax({
				 	 type: "POST",
				 	 url: "UScript.php",
				 	 data: {MPart:Mpage, SLink: 'blocksystem'},
				 	 success: PlaceBlock,
				 });
				}
 
 
 
 
 function IdeaFix(num) {
    allhtml='';
 	SaveHtml=	$("div[Num='"+num+"']").html();
    newhtml=SaveHtml.split('<p num="'+num+'">');
    for (i=1; i<=newhtml.length-1; i++){
    allhtml=allhtml+newhtml[i];
}
    allhtml=allhtml.split('</p><p>');
    lastp=allhtml[allhtml.length-1].split('</p>')[0];
    TAText='';
    for (i=0; i<allhtml.length-1; i++){
    TAText=TAText+allhtml[i]+'\n\r';
}
    TAText=TAText+lastp;
    setTimeout(function(){
 	$("div[Num='"+num+"']:first").html('<textarea id="RedactIdeas" onkeyup="OrLY(event, '+num+', '+"'"+'UI'+"'"+')" style="border-style:none;color:#ffffff; resize:none; background:url(TA.png); width:'+($("div[Num='"+num+"']").width()-10)+'; height:'+($("div[Num='"+num+"']").height()+10)+'" onblur="unfocus('+num+')">'+TAText+"</textarea>");
  $("#RedactIdeas").focus();
}, 10);
 }
 
  function OrLY(e, num, FormName){

  if (((e.keyCode == 13) || (e.keyCode == 10)) && (e.ctrlKey == false)){
  	
				
		if (FormName == 'AC') {
				Fixed=strget($("#comment").attr('value'));
    $.ajax({
				 	 type: "POST",
				 	 url: "UScript.php",
				 	 data: {id:num, Comment:Fixed, SLink: 'CommentIdea'},
				 	 success: diito,
				 });
				}
		if (FormName == 'LG') {
				$('#LGFRM').submit()
		}

}
  if (((e.keyCode == 13) || (e.keyCode == 10)) && (e.ctrlKey == true)){
if (FormName == 'UI') {
  	Fixed=strget($("#RedactIdeas").attr('value'));
    $.ajax({
				 	 type: "POST",
				 	 url: "UScript.php",
				 	 data: {num:num, Idea:Fixed, SLink: 'UpdateIdea'},
				 	 success: diito,
				 });
				}
  
  }
}

  
 	
 	function diito(data)
  {
  	top.location.href='http://animeforge.com/'
  }
  
  
  function unfocus(elem) {
  		$("div[Num='"+elem+"']:first").html(SaveHtml);
  }
  
	$(document).ready(function(){

		    $("#AFContacts").bind("click", function(){

		    	
		    });


$('input[name="Pass"]').focus(function(){
		 			$(this).attr('value', '');
		 			document.LoginForm.Pass.type='password';
		 		});

		 	  $("#Move").bind({
		 	  mouseenter: function(){
		 	  $(this).attr('src', '../style/'+$(this).attr('direc')+'_h.png');
		 	  },
		 	  
		 	  mouseleave: function(){
		 	  $(this).attr('src', '../style/'+$(this).attr('direc')+'.png');
		 	  },
		 	  
		 	   click: function(){
		 	   MenuMove($(this).attr('direc'), 'Profile');
		 	   if ($(this).attr('direc') == 'down') { NewDirect='up';} else {NewDirect='down';}
		 	  $(this).attr('DIREC', NewDirect);
		 	  $(this).attr('src', '../style/'+NewDirect+'.png');
		 	  }
		 	  });
		 		PageConstructor('Main');
		 		SliderConstructor();
		 		$('input[name="Login"]').focus(function(){
		 			$(this).attr('value', '');
		 		
		 		});
		 		
		 		
		 		
		 	});




function SaveChanges()
{


	var SPtype = $("#setform").attr("name");
	switch (SPtype) 
	{
		case "Addit":
		var SPMas={"name":strget($("input[name='name']").attr("value")), "Phone":$("input[name='Phone']").attr("value")};
		break;
		
		case "Main":
        var SPMas={"NewPwd": $("input[name='NewPwd']").attr("value")};

        break;
		default:
		var SPMas="NOAJAX";

		break;
	}

	if (SPMas != "NOAJAX")
	{
$.ajax({
				 	 type: "POST",
				 	 url: "UpdateSettings.php",
				 	 data: {type:SPtype, fields:SPMas},
				 });
}
	
}
