/*------------- Base Function ------------------------------------*/
	function isEmail(emailStr)
    {
            var reEmail=/^[0-9a-zA-Z_\.-]+\@[0-9a-zA-Z_\.-]+\.[0-9a-zA-Z_\.-]+$/;
            if(!reEmail.test(emailStr))
            {
                    return false;
            }
            return true;
    }
	
	function RAVIN_HideHandler( handlerID ){
		jQuery('#'+handlerID).slideUp(500);
	}

	function RAVIN_DelayedHide( handlerID ){
		setTimeout( "RAVIN_HideHandler('"+handlerID+"')" , 3000 );
	}
/*------------- Save Bleat ---------------------------------------*/
	function saveBlit(urlpath)
   {	 
	  var bleatvalue			=	jQuery.trim($("#bleat").val());
	  var url					=	$("#url").val();
	  var twitter				=	$("input#twitter:checked").val();
	  var facebook				=	$("input#facebook:checked").val();
	  var bleaterId				=	$("input#bleaterId").val();
	  var bleaterImage			=	$("input#bleaterImage").val(); 
	  var bleaterImageSmall		=	$("input#bleaterImageSmall").val();
	
	  bleatvalue1	=	bleatvalue.replace(/[&]/g, '##');
	  
	  if(bleaterImage != "" && bleaterImageSmall == ""){
		  	$("p#errorcrop").fadeIn(1000);
			RAVIN_DelayedHide('errorcrop');
			return false;
	  }
	  
	if(bleatvalue == "")
	{
		$("p#errorbleat").fadeIn(1000);
		RAVIN_DelayedHide('errorbleat');
		
	}else{
		
		document.getElementById('submit').disabled=true;
		$("#systemWorking").fadeIn(800);
		
		$("#bleat").attr("value","");
		$("#url").attr("value","");
		$(".checkbox").attr("style","background-position: 0pt 0pt;");
		/*$(".checkbox").attr('checked',false);*/
		
		
		
		$("input#facebook").attr('checked',false);
		$("input#twitter").attr('checked',false);

		$.ajax({
			type: "POST",
			url: urlpath,
			data: "bleat="+bleatvalue1+"&url="+url+"&twitter="+twitter+"&facebook="+facebook+"&bleaterId="+bleaterId+"&image="+bleaterImage,
			cache: false,
			success: function(html){
				if(html == 1)
				{
					$("#systemWorking").fadeOut(400);
					$("#errorbleat").fadeOut(200);
					RAVIN_DelayedHide('errorbleat');
				}else if(html == 2){
					$("#systemWorking").fadeOut(100);
					$("#errorbleat").fadeIn(200);
					$("#errorbleat").html('Bleat should be a short message no longer than 140 characters');
					RAVIN_DelayedHide('errorbleat');
					document.getElementById('submit').disabled=false;
				}else{
					$("#systemWorking").fadeOut(400);
					$("#errorbleat").fadeOut(200);					
					RAVIN_DelayedHide('errorbleat');
					$("div#bleats").prepend(html).slideDown('slow');

					/*---------------------------*/	
					$("a#displayUploadedImage").hide();
					$("span#cropmessage").hide();
					$("#addimage").slideUp("slow");
					
					$("input#bleaterImage").attr("value","");
					$("input#bleaterImageSmall").attr("value","");					
                    
                                        
					document.getElementById('submit').disabled=false;
					
					$("#nobleat").fadeOut(200);		
					/*---------------------------*/
				}
			}
			});
	}return false;
	}

 
	function showUploadImageField()
	{
		$("#addimage").slideDown("slow");
	}
/*------------- Limit Textarea size on Bleat form ---------------------*/
	function limitText(limitNum, event) {
		
		var keycode = (event.keyCode ? event.keyCode : event.which);		
		
		var bleatText	=	$("#bleat").val();
		
		var bleatTextCount = bleatText.length;
		//alert(bleatTextCount);
		if(keycode == '13'){
			//alert('You pressed a "enter"');			
			$("#bleat").val(bleatText.substring(0, bleatTextCount));
			//event.stopPropagation();
		}else{		
		
			if (bleatTextCount > limitNum) 
			{
				$("#bleat").val(bleatText.substring(0, limitNum));
			} else {
				$("span#countdown").text(limitNum - bleatTextCount);
			}
		
		}
	}
	
	function uncheckCheckBox()
	{
		$(".checkbox").attr("style","background-position: 0pt 0pt;");
	}
/*-------------- Hide Bleat form -----------------*/	
	function hideBleetForm()
	{
		 $("div#post-a-bleater").slideUp(1000);		
	}
/*-----------------------------------------------*/
	function setLastId(paging, requesturl)
	{
		$.post(requesturl, {paging:paging  },
				   function(html){					
					//alert(html);
					$("input#paging").val(html);		
				});
	}
	
	function setLastIdBleater(paging, bleater, requesturl)
	{
		$.post(requesturl, {paging:paging, bleater:bleater  },
				   function(html){					
					//alert(html);
					$("input#paging").val(html);		
				});
	}
/*------------- View More Bleat -----------------*/
	function viewMoreBleat(urlpath)
	{		
		var paging =	$("input#paging").val();
		
		$("#loadingmore").show();
		
		$.ajax({
			type: "POST",
			url: urlpath,
			data: "paging="+paging,
			cache: false,
			success: function(html){
				if(jQuery.trim(html) == 'nomore')
				{
					$("span#loadingmore").hide();
					$("span#nomore").text('There are no more bleat to show right now');					
				}else{
					$("span#loadingmore").hide();
					//$("input#paging").val(parseInt(paging)-10);					
					setLastId(paging, '/bleater/index/set-last-id');
					$("div#bleats").append(html);				
					
				}
			}
			});
	}
	
	 function viewMoreBleatBleater(urlpath, bleater)
	 {
		 var paging =	$("input#paging").val();		
			
			$("span#loadingmore").show();
		
			$.ajax({
				type: "POST",
				url: urlpath,
				data: "paging="+paging+"&bleaterId="+bleater,
				cache: false,
				success: function(html){
					if(jQuery.trim(html) == 'nomore')
					{
						$("span#loadingmore").hide();
						$("#nomore").text('There are no more bleat to show right now');					
					}else{
						$("span#loadingmore").hide();
						//$("input#paging").val(parseInt(paging)-7);					
						setLastIdBleater(paging, bleater, '/bleater/index/set-last-id-bleater');
						
						$("div#bleats").append(html);				
						
					}
				}
				});
	 }
/*----------- View more Bleat of particular Bleater ------------------*/
	function viewMoreBleatOfBleeter(urlpath)
	{
		
		var paging =	$("input#paging").val();
		var bleaterId =	$("input#BleeterBleet").val();
		
		$("span#loadingmore").show();
	
		$.ajax({
			type: "POST",
			url: urlpath,
			data: "paging="+paging+"&bleaterId="+bleaterId,
			cache: false,
			success: function(html){
				if(jQuery.trim(html) == 'nomore')
				{
					$("span#loadingmore").hide();
					$("#nomore").text('There are no more bleat to show right now');					
				}else{
					$("span#loadingmore").hide();
					$("input#paging").val(parseInt(paging)-7);					
					
					$("div#bleats").append(html);				
					
				}
			}
			});
	}
	
	$(document).ready(function(){
		$("a#closeBleaterAccountDetailForm").click(function(){
			$("div#bleaterAccountDetailForm").fadeOut('slow');		
		});
	});
	
	$(document).ready(function(){
		$("input#submitBleaterAccountDetailForm").click(function(){
			var bUsername	=	$("input#bUsername").val();
			var tUsername	=	$("input#tUsername").val();
			var tPassword	=	$("input#tPassword").val();
			var fbEmail		=	$("input#fbEmail").val();
			var fbPassword	=	$("input#fbPassword").val();
			
			var userId	=	$("input#userId").val();
			var urlpathsubmit	=	$("input#urlpathsubmit").val();
			
			if(bUsername == ""){
				alert("Please enter Bleater Username!!");
				return false;
			}
			if(tUsername == ""){
				alert("Please enter Twitter Username!!");
				return false;
			}
			if(tPassword == ""){
				alert("Please enter Twitter Password!!");
				return false;
			}
			if(fbEmail == ""){
				alert("Please enter Facebook email!!");
				return false;
			}			
			if(!isEmail(fbEmail))
			{
				alert("Please enter a valid e-mail id!!");
				docF.txtEmail.focus();
				return false;
			}			
			if(fbPassword == ""){
				alert("Please enter Facebook Password!!");
				return false;
			}
			
			datavalue="bleaterUserName="+bUsername+"&twitterUserName="+tUsername+"&twitterPassword="+tPassword+"&facebookEmail="+fbEmail+"&facebookPassword="+fbPassword+"&userId="+userId;
			
						$.ajax({
								type: "POST",
								url: urlpathsubmit,
								data: datavalue,
								cache: false,
								success: function(html){
									//alert(html);
									if(html == 1)
									{						
										$("div#right-inner").html("Your Bleater account has been created.");
									}
								}
							});
			
		});
	});

/*--------------------- Check Bleater username availability -----------------------*/	
	function checkBlitterUsername()
	{
			var bUsername	=	$("input#bUsername").val();
			
			if(bUsername.length > 16 || bUsername.length < 5){
				$("span#messageBleater").html("Character length should greater than 5 and less than 16!");
				$("span#createViewBleaterSubmit").hide();
				$("span#createViewBleaterButton").show();
				return false;
			}


			var urlpath	=	$("input#urlpath").val();
			
					
			if(bUsername == ""){
				//$("span#messageBleater").html("Bleater Username can not blank");
				return false;
			}else{
				$("span#bUsernamecheck").show();
			$.ajax({
				type: "POST",
				url: urlpath,
				data: "bUsername="+bUsername,
				cache: false,
				success: function(html){
					if(html == 1)
					{		
						$("span#bUsernamecheck").hide();
						$("span#createViewBleaterSubmit").show();
						$("span#createViewBleaterButton").hide();
						$("span#messageBleater").html("is available!");
					}else{
						$("span#bUsernamecheck").hide();
						$("span#createViewBleaterSubmit").hide();
						$("span#createViewBleaterButton").show();
						$("span#messageBleater").html("Not available, please try again");		
					}
				}
			});
			}
	}
	
	function checkRegisterBlitterUsername()
	{
			var bUsername	=	$("input#bUsername").val();
			
			if(bUsername.length > 16 || bUsername.length < 5){
				$("span#messageBleater").html("Character length should greater than 5 and less than 16!");
				return false;
			}


			var urlpath	=	$("input#urlpath").val();
			
			
					
			if(bUsername == ""){
				$("span#messageBleater").html("Bleater Username can not blank!");
				return false;
			}else{
				$("span#bUsernamecheck").show();
			$.ajax({
				type: "POST",
				url: urlpath,
				data: "bUsername="+bUsername,
				cache: false,
				success: function(html){
					if(html == 1)
					{	
						$("span#bUsernamecheck").hide();
						$("span#messageBleater").html("is available!");
					}else{	
						$("span#bUsernamecheck").hide();
						$("span#messageBleater").html("Not available, please try again");		
					}
				}
			});
			}
	}
	
	function checkBlitterUsernameForm()
	{
		var bUsername	=	$("input#bUsername").val();
		
		if(bUsername == ""){
			$("span#messageBleater").html("Bleater Username can not blank!");
			return false;
		}
		
		if(bUsername.length < 5){
			$("span#messageBleater").html("Bleater Username can not less than 5 character!");
			return false;
		}
	}

		

	

/*------------- Image Upload ---------------------------------*/
	function ajaxFileUpload()
	{	
		$("span#loadingupload").show();
		
		$("span#loadingupload").html("<img src='/images/loadingmore.gif'>");
		uploadUrl = $("input#bleatImageUploadUrl").val();
		
		$.ajaxFileUpload({
				url:uploadUrl,
				secureuri:false,
				fileElementId:'fileToUpload',
				dataType: 'json',
				success: function (data, status){
					if(typeof(data.error) != 'undefined'){
						if(data.error != ''){
							$("span#loadingupload").html("Image has not uploaded!");
							$("#fileToUpload").attr("value","");
							//alert(data.error);
						}else{
							
							$("#fileToUpload").attr("value","");
							$("span#loadingupload").hide();
							
							$("span#cropmessage").show();
							
							$("a#displayUploadedImage").show();
							
							imageName	=	jQuery.trim(data.msg.substring(11));
							$("input#profileImageSave").val(imageName);
							$("a#displayUploadedImage").html("<img src="+"/images/bleats/"+imageName+" height='148'>");
							$("input#bleaterImage").val(imageName);
							
						}
					}
				},
				error: function (data, status, e){	
					$("span#loadingupload").html("Some problem has been occure, Please check image or browser!");
					$("#fileToUpload").attr("value","");		
					//alert(e);					
				}
			});		
		return false;
	}

/*----------------- Follow Bleater ---------------------------------*/
	function followBleater(followid, whosefollowing, spanid, followurl){
		
		if(isNaN(followid)==true){
			alert("You have not bleater account!");
			return false;
		}
		
		datavalue="followid="+followid+"&whosefollowing="+whosefollowing+"&spanid="+spanid;
		$("span."+spanid).html("<img src='/images/loadingmore.gif'>");
		$.ajax({
			type: "POST",
			url: followurl,
			data: datavalue,
			cache: false,
			success: function(html){					
					//---> Update Flock
			//alert(whosefollowing);
					var flockCount	=	$(".flock_"+spanid).html();//alert(flockCount);
					$(".flock_"+spanid).html(parseInt(flockCount)+1);	
					$("span."+spanid).html(html);				
			}
		});
	}
/*------------------------------- Unfollow Bleater -----------------------------------------*/
	function unFollowBleater(followid, whosefollowing, spanid, followurl)
	{
		if(isNaN(followid)==true){
			alert("You have not bleater account!");
			return false;
		}
		
		datavalue="followid="+followid+"&whosefollowing="+whosefollowing+"&spanid="+spanid;
		$("span."+spanid).html("<img src='/images/loadingmore.gif'>");
		$.ajax({
			type: "POST",
			url: followurl,
			data: datavalue,
			cache: false,
			success: function(html){
					//---> Update Flock
					var flockCount	=	$(".flock_"+spanid).html();
					$(".flock_"+spanid).html(parseInt(flockCount)-1);	
					$("span."+spanid).html(html);
			}
		});
	}

	
	
/*--------------------- Bleat Reply -------------------------------------*/
	function openBleatReplyForm(divid)
	{
		$("div#"+divid).toggle(500);
	}
	
	function showHideBleatReply(divid, innerdivid)
	{
		$("div#"+divid).toggle('fast');
		
		//$("a#"+innerdivid).html($("a#"+innerdivid).html() == '<img src="/themes/default/images/show-replies.png">' ? '<img src="/themes/default/images/hide-replies.png"/>' : '<img src="/themes/default/images/show-replies.png"/>'); // <- HERE

	}
	
	
	function saveBleatReply(textareaId, bleatId, bleaterid, urlReply)
	{	
		var responce	=	jQuery.trim($("#"+textareaId).val());
		
		responce1	=	responce.replace(/[&]/g, '##');
		
		if(responce == "")
		{
			alert("Please enter your Response!");
			return false;
		}
		
		datavalue="bleatId="+bleatId+"&bleaterid="+bleaterid+"&responce="+responce1;
		
		$.ajax({
			type: "POST",
			url: urlReply,
			data: datavalue,
			cache: false,
			success: function(html){				
					$("#bleatreply_"+bleatId).attr("value","");	
					$("div#responce_"+bleatId).append(html);
					$("div#reply_"+bleatId).slideUp(500);					
				
			}
		});		
	}
/*------------------- Bleater Profile Snap ---------------------------------*/
	function ajaxBleaterSnapUpload()
	{		
		uploadUrl = $("input#bleaterSnapUploadUrl").val();
		imageSnap = $("input#fileToUpload").val();
		
		if(imageSnap == "")
		{
			$("span#loadingupload").html("Please select Image!");
			return false;
		}
		
		$("span#loadingupload").html("<img src='/images/loadingmore.gif'>");
		
		$.ajaxFileUpload({
				url:uploadUrl,
				secureuri:false,
				fileElementId:'fileToUpload',
				dataType: 'json',
				success: function (data, status){
					if(typeof(data.error) != 'undefined'){
						if(data.error != ''){
							$("span#loadingupload").html("Image has not uploaded!");
							$("#fileToUpload").attr("value","");
							alert(data.error);
						}else{
							$("span#loadingupload").html("Image has been uploaded, click on image to Crop!");
							$("#fileToUpload").attr("value","");
							
							$("input#snapImageCropped").attr("value",""); // Blank cropped hidden value
							
							$("#showEditImage").hide();							
							imageName	=	jQuery.trim(data.msg.substring(11));
							$("input#snapImage").val(imageName);								
							$("#spanImageShow").show();
							+"?"+Math.random()
							$("a#displayUploadedImage").html("<img src="+"/images/bleatersnap/"+imageName+"?"+Math.random()+" width='212'>");
							$("span#cropmessage").show();
							
						}
					}
				},
				error: function (data, status, e){	
					$("span#loadingupload").html("Some problem has been occure, Please check image or browser!");
					$("#fileToUpload").attr("value","");		
					//alert(e);					
				}
			});	
		return false;
	}
	
	function checkBlitterSnapForm()
	{
		var snapImage			=	$("input#snapImage").val();
		var snapImageCropped	=	$("input#snapImageCropped").val();
		var snapDesc			=	jQuery.trim($("#snapDesc").val());
		
		if(snapImage==""){
			alert("Please select bleater profile snap!");
			return false;
		}
		
		if(snapImage!="" && snapImageCropped == ""){
			alert("Please crop bleater profile snap!");
			return false;
		}
		
		if(snapDesc == "")
		{
			alert("Please add a short description about your profile snap!");
			return false;
		}
	}
	
	
	
	/*----------------------------------------------------------------------------------------------*/
	function ajaxCompetitionImageUploadFileName()
	{
		var imgName	=	document.getElementById("fileToUpload").value;
		$("input#fakeupload").attr("value",imgName);
	}
	
	/*-------------------------------Upload Competition Image---------------------------------------*/
	function ajaxCompetitionImageUpload()
	{		
		uploadUrl = $("input#competitionImageUploadUrl").val();
		imagePro = $("input#fileToUpload").val();
		
		if(imagePro == "")
		{
			$("span#loadingupload").html("Please select outfit Image!");
			return false;
		}
		
		$("span#loadingupload").html("<img src='/images/loadingmore.gif'>");
		
		$.ajaxFileUpload({
				url:uploadUrl,
				secureuri:false,
				fileElementId:'fileToUpload',
				dataType: 'json',
				success: function (data, status){
					if(typeof(data.error) != 'undefined'){
						if(data.error != ''){
							$("span#loadingupload").html("Image has not uploaded!");
							$("#fileToUpload").attr("value","");
							//alert(data.error);
						}else{
							$("span#loadingupload").html("Image has been uploaded!");
							$("#fileToUpload").attr("value","");
							imageName	=	data.target_file_name;
							$("input#competitionImageSave").val(imageName);
							imageName=imageName+"?"+Math.random();							
							$("span#cropmessage").show();
							$("#displayUploadedImage").html("<img src="+"/images/competition/outfit/"+imageName+" width='140'>");
							
						}
					}
				},
				error: function (data, status, e){	
					$("span#loadingupload").html("Some problem has been occure, Please check image or broswer!");
					$("#fileToUpload").attr("value","");		
					//alert(e);					
				}
			});		
		return false;
	}
	
	
	function saveCompetitionImage()
	{
		var imagename		=	$("input#competitionImageSmall").val();
		var title 			=	$("input#fname").val();
		var lname 			=	$("input#lname").val();
		var location 		=	$("input#location").val();
		var description 	=	$("textarea#description").val();
		var c_id			=	$("input#comp_id").val();
		var originalImage	=	$("input#competitionImageSave").val();
		
		description1	=	description.replace(/[&]/g, '##');
		
		if(c_id=="")
		{
			$("span#loadingupload").html("Invalid request!");
			return false;
		}		
		
		if(title=="")
		{
			alert("Please enter First Name!");
			return false;
		}
		/*if(lname=="")
		{
			alert("Please enter Last Name!");
			return false;
		}*/
		if(location=="")
		{
			alert("Please enter Location!");
			return false;
		}
		if(imagename=="")
		{
			alert("Please crop the image before save!");
			return false;
		}
		
		if(description=="")
		{
			
			alert("Please enter the description!");
			return false;
		}
		
		var requesturl=$("input#competitionImageSaveUrl").val();
		var params="image="+imagename+"&title="+title+"&description="+description1+"&comptId="+c_id+"&lastName="+lname+"&location="+location+"&originalImage="+originalImage;		
		
		document.getElementById('save').disabled=true;
		$("span#loadinguploadsave").html("<img src='/images/loadingmore.gif'>");
		
		$.post(requesturl, {image:imagename, title:title, description:description1, comptId:c_id, lastName:lname, location:location, originalImage:originalImage  },
				   function(html){					
					document.location.href='/user/competition/addimage-thankyou/id/'+html;
				});
		
		/*$.ajax({
			type: "POST",
			url: requesturl,
			data: params,
			cache: false,
			success: function(html){
				if(html >= 1)
				{
					document.location.href='/user/competition/addimage-thankyou/id/'+html;
					 -- reset values----
					$("input#competitionImageSave").val("");
					$("input#competitionImageSmall").val("");
					$("input#fileToUpload").show();
					$("span#competitionImageShow").show();
					$("span#competitionImageShow").html("<img src='/themes/default/images/profile-model.png' width='81'>");
					$("span#cropmessage").hide();
					$("a#displayUploadedImage").html("");
					$("span#loadinguploadsave").html("Your outfit photo and data has been saved and published.");
					$("input#competitionImageSmall").val("");
					$("input#title").val("");
					$("textarea#description").val("");
					document.getElementById('save').disabled=false;					
					 -- reset values----
				}else{
					alert("error: "+html );
				}					
			}
		});	*/
		
		
	}
/*------------------------------ UPDATE COMPETITION IMAGE -------------------------*/
	function editCompetitionImage()
	{
		var imagename	=	$("input#competitionImageSmall").val();
		var title 		=	$("input#fname").val();
		var lname 		=	$("input#lname").val();
		var location 	=	$("input#location").val();
		var description =	$("textarea#description").val();
		var c_id		=	$("input#comp_id").val();
		var imgId		=	$("input#imgId").val();
		
		description1	=	description.replace(/[&]/g, '##');

		
		if(c_id=="")
		{
			$("span#loadingupload").html("Invalid request!");
			return false;
		}		
		
		if(title=="")
		{
			alert("Please enter First Name!");
			return false;
		}
		/*if(lname=="")
		{
			alert("Please enter Last Name!");
			return false;
		}*/
		if(location=="")
		{
			alert("Please enter Location!");
			return false;
		}
		
		
		if(description=="")
		{
			
			alert("Please enter the description!");
			return false;
		}
		
		var requesturl=$("input#competitionImageSaveUrl").val();
		var params="image="+imagename+"&title="+title+"&description="+description1+"&comptId="+c_id+"&lastName="+lname+"&location="+location+"&id="+imgId;		
		
		document.getElementById('save').disabled=true;
		
		$("span#loadinguploadsave").html("<img src='/images/loadingmore.gif'>");
		
		$.ajax({
			type: "POST",
			url: requesturl,
			data: params,
			cache: false,
			success: function(html){
				if(html >= 1)
				{
					document.location.href='/user/competition/addimage-thankyou/id/'+html;
					/* -- reset values----*/
					/*$("input#competitionImageSave").val("");
					$("input#competitionImageSmall").val("");
					$("input#fileToUpload").show();
					$("span#competitionImageShow").show();
					$("span#competitionImageShow").html("<img src='/themes/default/images/profile-model.png' width='81'>");
					$("span#cropmessage").hide();
					$("a#displayUploadedImage").html("");
					$("span#loadinguploadsave").html("Your outfit photo and data has been saved and published.");
					$("input#competitionImageSmall").val("");
					$("input#title").val("");
					$("textarea#description").val("");
					document.getElementById('save').disabled=false;*/
					/* -- reset values----*/
				}
				else
				{
					alert("error: "+html );
				}					
			}
		});	
		
		
	}
	
/*------------------------------ ACCEPT FOLLOWERS REQUEST -------------------------*/
	
	function acceptFollowersRequset(spanId, id, relationto, requesturl)
	{
		datavalue="id="+id+"&relationto="+relationto;
		
		$("#"+spanId).html("<img src='/images/loadingmore.gif'>");
		
		$.ajax({
			type: "POST",
			url: requesturl,
			data: datavalue,
			cache: false,
			success: function(html){
				if(html != 0){
					$("#countrequest").html(html);
				}else{
					$("#show_followers_requset").hide();					
				}
					
					$("#"+spanId).html('Accepted');					
			}
		});	
	}


  /*------------------------------ ACCEPT ALL FOLLOWERS REQUEST -------------------------*/

	function acceptAllFollowersRequset(spanIds, ids, relationtos, requesturl)
	{
            returnVal = true;
            spanIds_Arr = spanIds.split(",");
            ids_Arr = ids.split(",");
            relationtos_Arr = relationtos.split(",");
            for(i=0;i<spanIds_Arr.length;i++) {
                spanId      = spanIds_Arr[i];
                id          = ids_Arr[i];
                relationto  = relationtos_Arr[i];

                if(acceptFollowersRequset(spanId, id, relationto, requesturl)){
                    returnVal = true;
                }
                else {
                    returnVal = false;
                }
                //alert(spanId+"\n"+id+"\n"+relationto+"\n"+requesturl);
            }
            return returnVal;
	}
	
/*----------------------------------- COMPETITION PICTURE -----------------------------*/
	function competitionPicture(competitionId)
	{   
		var competitionImageUrl	=	$("#competitionImageUrl").val();
	  
		datavalue="competitionId="+competitionId;
		
		$("#sssssssssssssssss").show();
		$.ajax({
			type: "POST",
			url: competitionImageUrl,
			data: datavalue,
			cache: false,
			success: function(html){
					$("#sssssssssssssssss").hide();
					//$(".jcarousel-skin-tango2").remove();
					//$("#competitionImages").append(html);
					
					//$("ul#mycarousel4").empty();
					//$("ul#mycarousel4").append(html);
					$("#right-slider-container").html(html);
					//alert($("#right-slider-container").html());
					//alert($("ul#mycarousel2").html());
					jQuery.easing['BounceEaseOut'] = function(p, t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
};

				jQuery('#mycarousel4').jcarousel({
					easing: 'swing',
					animation: 400,
					scroll: 1
				});
					
								
			}
		});
	
	}
	
	
/*----------------- ARTICLE IMAGES ---------------------*/

	function articlePicture(catId)
	{   
		var articleImageUrl	=	$("#articleImageUrl").val();
	  
		if(catId!="")
		{
		datavalue="catId="+catId;
	    }
		
		//$("#uuuuu").show();
		$.ajax({
			type: "POST",
			url: articleImageUrl,
			data: datavalue,
			cache: false,
			success: function(html){
					//$("#uuuuu").hide();
					//$(".jcarousel-skin-tango2").remove();
					//$("#competitionImages").append(html);
					//$("ul#mycarousel2").empty();
					//$("ul#mycarousel2").append(html);
					$("#top-article-slider-container").html(html);
					//alert($("ul#mycarousel2").html());
					jQuery.easing['BounceEaseOut'] = function(p, t, b, c, d) {
	if ((t/=d) < (1/2.75)) {
		return c*(7.5625*t*t) + b;
	} else if (t < (2/2.75)) {
		return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
	} else if (t < (2.5/2.75)) {
		return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
	} else {
		return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
	}
};


jQuery('#mycarousel2').jcarousel({
        easing: 'swing',
        animation: 400,
        scroll: 1
    });

								
			}
		});
	
	}
	
	/*----------------- ARTICLE IMAGES FOR 3 CATEGORIES ---------------------*/

	function articlePicture3(catId1,catId2,catId3)
	{   
		var articleImageUrl	=	$("#articleImageUrl").val();
	  
		if(catId1!="")
		{
		datavalue="catId1="+catId1+"&catId2="+catId2+"&catId3="+catId3;
	    }
		
		//$("#uuuuu").show();
		$.ajax({
			type: "POST",
			url: articleImageUrl,
			data: datavalue,
			cache: false,
			success: function(html){
					//$("#uuuuu").hide();
					//$(".jcarousel-skin-tango2").remove();
					//$("#competitionImages").append(html);
					//$("ul#mycarousel2").empty();
					//$("ul#mycarousel2").append(html);
					$("#top-article-slider-container").html(html);
					//alert($("ul#mycarousel2").html());
					jQuery.easing['BounceEaseOut'] = function(p, t, b, c, d) {
	if ((t/=d) < (1/2.75)) {
		return c*(7.5625*t*t) + b;
	} else if (t < (2/2.75)) {
		return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
	} else if (t < (2.5/2.75)) {
		return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
	} else {
		return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
	}
};


jQuery('#mycarousel2').jcarousel({
        easing: 'swing',
        animation: 400,
        scroll: 1
    });

								
			}
		});
	
	}

	
/*----------------- PROFILE PAGE ------------------------*/	
/*-------------------- High Street Hotest Articles Category Wise ------*/
function streetHotestPicture(catId)
{


var artImageUrl	=	$("#artImageUrl").val();
	artImageUrl=artImageUrl+"/cat/"+catId;
	
	$(window.location).attr('href',artImageUrl)
		
		

}
/*-------------------- END High Street --------------------------------*/


/*-----------------UPDATE FB ID -------------------------*/
	
	//jQuery.noConflict();
	
	function addFbIdTODb(fbid)
	{
		var fburl 	= $("input#fburl").val();
		var id 		= $("input#id").val();
		
		datavalue="fbid="+fbid+"&userid="+id;
		
		$.ajax({
			type: "POST",
			url: fburl,
			data: datavalue,
			cache: false,
			success: function(html){
				$("#fbaccount").show();
			}
		});
	}
	
	/*----------------------- Update User Basic Profile ---------------------------*/	
	function updateBasicProfile()
	{
		
		var id	=	$("input#id").val();
		var country	=	$("input#country").val();
		var cityName	=	$("input#cityName").val();
		
		var urlpathbasic	=	$("input#urlpathbasic").val();
		
		datavalue="id="+id+"&country="+country+"&cityName="+cityName;
		
		$("span#loaderUpdateBasicProfile").show();
		
		$.ajax({
			type: "POST",
			url: urlpathbasic,
			data: datavalue,
			cache: false,
			success: function(html){				
				if(html == 1)
				{		
					$("span#loaderUpdateBasicProfile").hide();
					$("div#msgUpdateBasic").slideDown('slow');
					RAVIN_DelayedHide('msgUpdateBasic')
				}
			}
		});
		
	}
	
	/*-------------------------------Upload profile Image---------------------------------------*/
	function ajaxProfileImageUpload()
	{		
		uploadUrl = $("input#profileImageUploadUrl").val();
		imagePro = $("input#fileToUpload").val();
		
		if(imagePro == "")
		{
			$("span#loadingupload").html("Please select profile Image!");
			return false;
		}
		
		$("span#loadingupload").html("<img src='/images/loadingmore.gif'>");
		
		$.ajaxFileUpload({
				url:uploadUrl,
				secureuri:false,
				fileElementId:'fileToUpload',
				dataType: 'json',
				success: function (data, status){
					if(typeof(data.error) != 'undefined'){
						if(data.error != ''){
							$("span#loadingupload").html("Image has not uploaded!");
							$("#fileToUpload").attr("value","");
							//alert(data.error);
						}else{
							$("span#loadingupload").html("Image has been uploaded, Crop before save!");
							$("#fileToUpload").attr("value","");							
							
							imageName	=	$.trim(data.msg.substring(11));
							$("input#profileImageSave").val(imageName);
							$("span#profileImageShow").hide();
							$("span#cropmessage").show();
							
							$("span#profileImageShow").hide();
							
							$("a#displayUploadedImage").show(); 
							
							$("a#displayUploadedImage").html("<img src="+"/images/profile/"+imageName+" width='78'>");
							
						}
					}
				},
				error: function (data, status, e){	
					
					$("span#loadingupload").html("Some Problem has been occure, Please check image or your browser!");
					$("#fileToUpload").attr("value","");		
					//alert(e);					
				}
			});		
		return false;
	}
	
	function updateProfileImage()
	{
		var id = $("input#id").val();
		var profileImageSave = $("input#profileImageSave").val();

		var profileImageSaveUrl = $("input#profileImageSaveUrl").val();
		
		var profileImageSmall		=	$("input#profileImageSmall").val();

		  if(profileImageSave != "" && profileImageSmall == ""){
			  $("span#loadingupload").html("Please crop image before save!");			  	
				return false;
		  }
		
		datavalue="profileImageSave="+profileImageSave+"&userid="+id;
		//alert(datavalue);
		$("span#loadingupload").html("<img src='/images/loadingmore.gif'>");
		
		$.ajax({
			type: "POST",
			url: profileImageSaveUrl,
			data: datavalue,
			cache: false,
			success: function(html){
				if(html == 1)
				{
					//$("span#loaderSocialNetworkDetail").hide();
					$("span#loadingupload").html('Profile image has been saved!');
					//$("div#msgSocialNetworkDetail").slideDown('slow');
					//RAVIN_DelayedHide('msgSocialNetworkDetail');
				}
			}
		});
	}
	
	/*-------------------- Update Facebook Password ------------------------*/
	function updateProfilePassword()
	{
		var id					=		$("input#id").val();
		var password			=		$("input#password").val();
		var newPassword			=		$("input#newPassword").val();
		var confPassword		=		$("input#confPassword").val();
		var urlprofilepassword	=		$("input#urlprofilepassword").val();
		
		if(password == ""){
			$("div#msgProfilePassword").html('Old Password should not be blank!');
			$("div#msgProfilePassword").slideDown('slow');
			RAVIN_DelayedHide('msgProfilePassword');
			return false;
		}
		
		if(newPassword == ""){
			$("div#msgProfilePassword").html('New Password should not be blank!');
			$("div#msgProfilePassword").slideDown('slow');
			RAVIN_DelayedHide('msgProfilePassword');
			return false;
		}
		
		if(newPassword.length < 6){
			$("div#msgProfilePassword").html('New Password should be more than 5 character!');
			$("div#msgProfilePassword").slideDown('slow');
			RAVIN_DelayedHide('msgProfilePassword');
			return false;
		}
		
		if(newPassword != confPassword)
		{
			$("div#msgProfilePassword").html('Confirm Password should be match to New Password!');
			$("div#msgProfilePassword").slideDown('slow');
			RAVIN_DelayedHide('msgProfilePassword');
			return false;
		}
		
		datavalue="id="+id+"&password="+password+"&newPassword="+newPassword;
		
		$("span#loaderProfilePassword").show();
		
		$.ajax({
			type: "POST",
			url: urlprofilepassword,
			data: datavalue,
			cache: false,
			success: function(html){
				if(html == 1)
				{
					$("span#loaderProfilePassword").hide();
					$("div#msgProfilePassword").html('Your password has been updated!');
					/*---------------------------*/					
					$("input#password").attr("value","");
					$("input#newPassword").attr("value","");
					$("input#confPassword").attr("value","");					
					/*---------------------------*/
					$("div#msgProfilePassword").slideDown('slow');
					RAVIN_DelayedHide('msgProfilePassword');
				}else if(html == 2){
					$("span#loaderProfilePassword").hide();
					$("div#msgProfilePassword").html('Old Password has not correct!');
					$("div#msgProfilePassword").slideDown('slow');
					RAVIN_DelayedHide('msgProfilePassword');
				}
			}
		});
	}
	
	/*-------------- UPDATE FACEBOOK , TWITTER DETAIL ---------------*/
	function updateSocialNetworkDetail()
	{
		var id					=		$("input#id").val();
		var twitterUserName		=		$("input#twitterUserName").val();
		var twitterPassword		=		$("input#twitterPassword").val();
		
		
		if(twitterUserName == "" || twitterPassword == "")
		{
			$("div#msgSocialNetworkDetail").html('Fields should not be blank!');
			$("div#msgSocialNetworkDetail").slideDown('slow');
			RAVIN_DelayedHide('msgSocialNetworkDetail');
			return false;
		}
		
				
		var urlSocialNetworkDetail	=		$("input#urlSocialNetworkDetail").val();
		
		datavalue="id="+id+"&twitterUserName="+twitterUserName+"&twitterPassword="+twitterPassword;
		
		$("span#loaderSocialNetworkDetail").show();
		
		$.ajax({
			type: "POST",
			url: urlSocialNetworkDetail,
			data: datavalue,
			cache: false,
			success: function(html){
				if(html == 1)
				{
					$("span#loaderSocialNetworkDetail").hide();
					$("div#msgSocialNetworkDetail").html('Twitter Account Detail has been updated!');
					$("div#msgSocialNetworkDetail").slideDown('slow');
					RAVIN_DelayedHide('msgSocialNetworkDetail');
				}else if(html == 2){
					$("span#loaderSocialNetworkDetail").hide();
					$("div#msgSocialNetworkDetail").html('Please check Twitter Account Details!');
					$("div#msgSocialNetworkDetail").slideDown('slow');
					RAVIN_DelayedHide('msgSocialNetworkDetail');
				}else if(html == 3){
					$("span#loaderSocialNetworkDetail").hide();
					$("div#msgSocialNetworkDetail").html('Your Twitter Account has not setup!');
					$("div#msgSocialNetworkDetail").slideDown('slow');
					RAVIN_DelayedHide('msgSocialNetworkDetail');
				}
			}
		});
		
	}
	
/*---------------------REPORT ABUSE FORM-------------------------------------*/
	function reportAbuseOpenForm(reportAbuserFormId)
	{
		$("div#"+reportAbuserFormId).toggle(600);
	}
	
	function sendReportAbuse(emailId, reportCommentId, commentId, reportAbuserFormId, abuseUrl)
	{
		
		var reportEmail					=		$("input#"+emailId).val();
		var reportComment				=		$("#"+reportCommentId).val();
		var commentId					=		$("input#"+commentId).val();
		
		reportComment1	=	reportComment.replace(/[&]/g, '##');
		
		if(!isEmail(reportEmail))
		{
			alert("Please enter a valid e-mail id!!");			
			return false;
		}
		
		document.getElementById('cmdSave').disabled=true;
		datavalue="emailId="+reportEmail+"&reportComment="+reportComment1+"&commentId="+commentId;
		
		$.ajax({
			type: "POST",
			url: abuseUrl,
			data: datavalue,
			cache: false,
			success: function(html){
					document.getElementById('cmdSave').disabled=false;
					$("input#"+emailId).attr("value","");
					$("#"+reportCommentId).attr("value","");
					$("div#"+reportAbuserFormId).slideUp(500);
				
			}
		});		
	}

        function removeFollowing(followingId, bleaterId, fUrl)
        {
           
           if(confirm("Sure to remove?")) {
             datavalue = 'followingId='+followingId+'&bleaterId='+bleaterId;
             $.ajax({
			type: "POST",
			url: fUrl,
			data: datavalue,
			cache: false,
			success: function(html){
                    
                    	$('#following_'+followingId).fadeOut('slow');
                    	$(".following-heading").html(html);
                    	if(html != "<a class='follows' >0</a>")
                    	{
                    		$("#following-view").html(html);
                    	}else{
                    		$("#following-view-up").html(html);
                    	}
                    	
               
			}
		});

           }
        }

        function removeFollower(followerId, bleaterId, fUrl)
        {
           if(confirm("Sure to remove?")) {
             datavalue = 'followerId='+followerId+'&bleaterId='+bleaterId;
             
             $.ajax({
			type: "POST",
			url: fUrl,
			data: datavalue,
			cache: false,
			success: function(html){
                    
            	 $('#follower_'+followerId).fadeOut('slow');
            	 $(".followers-heading").html(html);
            	 if(html != "<a class='follows' >0</a>")
             	{
            		 $("#follower-view").html(html);
             	}else{
            		$("#follower-view-up").html(html);
            	}
            	 
			}
		});
                
           }
        }
  /*----------------------------------------------------------------------*/      
    function showOnlyMyBleats()
    {
    	var showbleats	= $("input#show-only-my-bleats:checked").val();
    	var myurl		= $("input#myurl").val();
    	 datavalue = 'showbleats='+showbleats;
    	
    	$.ajax({
			type: "POST",
			url: myurl,
			data: datavalue,
			cache: false,
			success: function(html){
    		
            	$("#bleats").html(html);   
            	
            	showOnlyMyBleatsShowMore(showbleats, myurl);
            	 
			}
		});
    }
    
    function showOnlyMyBleatsShowMore(showbleats, myurl)
    {
    	datavalue1 = 'showbleats='+showbleats;
    	
    	var newUrl	=	myurl+'-showmore';
    	
    	$.ajax({
			type: "POST",
			url: newUrl,
			data: datavalue1,
			cache: false,
			success: function(data){		
    		
	    		if(data	< 7)
				{
	        		$("span#nomore").hide();
				}else{
					$("span#nomore").show();
				}            	
            	 
			}
		});
    }
  /*-----------------------------------------------------------------------*/  
    
    function likePicture(picId, userId, styleId)
    {
    	if(userId	==	""){
                 $("#followbox_overlay").show();
                 $("#loginBoxPopup").fadeIn(800);
    		//$("#likeError").slideDown(800);
    		//$("#likeErrorTxt").html('Please log in to your account first');
    		//RAVIN_DelayedHide('likeError');
    		return false;
    	}else{
    		newUrl	=	"/default/index/like-picture";
    		datavalue = 'picId='+picId+'&userId='+userId;
    		
    		$.ajax({
    			type: "POST",
    			url: newUrl,
    			data: datavalue,
    			cache: false,
    			success: function(data){
	    		        	if(data != 0){
	    		        		//$("#likePic_"+picId).html(data);
	    		        		window.location="/shareyourstyle/detail/id/"+picId+"/style/"+styleId;
	    		        	}else if(data == 0){
	    		        		$("#likeError").slideDown(800);
	    		        		$("#likeErrorTxt").html('You have already liked this!');
	    		        		RAVIN_DelayedHide('likeError');
	    		        	}
    			}
    		});
    	}
    }
	
	
	function likePictureHottest(picId, userId)
    {
    	if(userId	==	""){
                 $("#followbox_overlay").show();
                 $("#loginBoxPopup").fadeIn(800);
    		//$("#likeError").slideDown(800);
    		//$("#likeErrorTxt").html('Please log in to your account first');
    		//RAVIN_DelayedHide('likeError');
    		return false;
    	}else{
    		newUrl	=	"/article/index/like-article";
    		datavalue = 'picId='+picId+'&userId='+userId;
    	
    		$.ajax({
    			type: "POST",
    			url: newUrl,
    			data: datavalue,
    			cache: false,
    			success: function(data){
	    		        	if(data != 0){
	    		        		//$("#likePic_"+picId).html(data);
	    		        		window.location="/article/index/view/id/"+picId;
	    		        	}else if(data == 0){
	    		        		$("#likeError").slideDown(800);
	    		        		$("#likeErrorTxt").html('You have already liked this!');
	    		        		RAVIN_DelayedHide('likeError');
	    		        	}
    			}
    		});
    	}
    }
    
    function likePictureDetail(picId, userId)
    {
    	if(userId	==	""){
                 $("#followbox_overlay").show();
                 $("#loginBoxPopup").fadeIn(800);
    		//$("#likeError").slideDown(800);
    		//$("#likeErrorTxt").html('Please log in to your account first');
    		//RAVIN_DelayedHide('likeError');
    		return false;
    	}else{
    		newUrl	=	"/default/index/like-picture";
    		datavalue = 'picId='+picId+'&userId='+userId;
    		
    		$.ajax({
    			type: "POST",
    			url: newUrl,
    			data: datavalue,
    			cache: false,
    			success: function(data){
	    		        	if(data != 0){
	    		        		$("#likePic_"+picId).html(data);	    		        		
	    		        	}else if(data == 0){
	    		        		$("#likeError").slideDown(800);
	    		        		$("#likeErrorTxt").html('You have already liked this!');
	    		        		RAVIN_DelayedHide('likeError');
	    		        	}
    			}
    		});
    	}
    }
    
    function likePictureDetail1(picId, userId)
    {
    	if(userId	==	""){
                $("#followbox_overlay").show();
                 $("#loginBoxPopup").fadeIn(800);
    		//$("#likeError").slideDown(800);
    		//$("#likeErrorTxt").html('Please log in to your account first');
    		//RAVIN_DelayedHide('likeError');
    		return false;
    	}else{
    		newUrl	=	"/default/index/like-picture";
    		datavalue = 'picId='+picId+'&userId='+userId;
    		
    		$.ajax({
    			type: "POST",
    			url: newUrl,
    			data: datavalue,
    			cache: false,
    			success: function(data){
	    		        	if(data != 0){
	    		        		$("#likePic1_"+picId).html(data);	    		        		
	    		        	}else if(data == 0){
	    		        		$("#likeError").slideDown(800);
	    		        		$("#likeErrorTxt").html('You have already liked this!');
	    		        		RAVIN_DelayedHide('likeError');
	    		        	}
    			}
    		});
    	}
    }
    
    function likeBleat(bleatId, userId, bleaterId)
    {
    	if(userId	==	""){
                 $("#followbox_overlay").show();
                 $("#loginBoxPopup").fadeIn(800);
    		//$("#likeError").slideDown(800);
    		//$("#likeErrorTxt").html('Please log in to your account first');
    		//RAVIN_DelayedHide('likeError');
    		return false;
    	}else if(bleaterId == 0 || bleaterId == ""){
    		$("#likeError").slideDown(800);
    		$("#likeErrorTxt").html('Oops, you don\'t have a Bleater account!');
    		RAVIN_DelayedHide('likeError');
    		return false;
    	} else {
    		newUrl	=	"/default/index/like-bleat";
    		datavalue = 'bleatId='+bleatId+'&userId='+bleaterId;
    		
    		$.ajax({
    			type: "POST",
    			url: newUrl,
    			data: datavalue,
    			cache: false,
    			success: function(data){
	    		        	if(data != 0){
	    		        		$("#bleatLike_"+bleatId).html(data);	    		        		
	    		        	}else if(data == 0){
	    		        		$("#likeError").slideDown(500);
	    		        		$("#likeErrorTxt").html('You have already liked this!');
	    		        		RAVIN_DelayedHide('likeError');
	    		        	}
    			}
    		});
    	}
    }
    
	function likeBleatHome(bleatId, userId, loggedinBleaterId, bleaterId)
    {

        var currentVal  =    $("#bleatLike_"+bleatId).html();
        
    	if(userId	==	""){
                 $("#followbox_overlay").show();
                 $("#loginBoxPopup").fadeIn(800);
                 //$("#loginUserBox").html('Please log in to your account first');
    		//$("#likeError").slideDown(800);
    		//$("#likeErrorTxt").html('Please log in to your account first');
    		//RAVIN_DelayedHide('likeError');
    		return false;
    	}else if(loggedinBleaterId	==	"" || loggedinBleaterId	==	0){
    		$("#likeError").slideDown(800);
    		$("#likeErrorTxt").html('Oops, you don\'t have a Bleater account!');
    		RAVIN_DelayedHide('likeError');
    		return false;
    	}else{
    		newUrl	=	"/default/index/like-bleat-home";
    		datavalue = 'bleatId='+bleatId+'&userId='+loggedinBleaterId+'&bleaterId='+bleaterId+'&user='+userId;
    		
    		$.ajax({
    			type: "POST",
    			url: newUrl,
    			data: datavalue,
    			cache: false,
    			success: function(data){
    		        	if(data  > 0){
    		        		$("#bleatLike_"+bleatId).html(data);	    		        		
    		        	}else if(data == 0){
    		        		$("#likeError").slideDown(500);
    		        		$("#likeErrorTxt").html('You have already liked this!');
    		        		RAVIN_DelayedHide('likeError');
    		        	} else {
                                        $("#followbox_overlay").show();
                                        $("#bleatLike_"+bleatId).html(parseInt(currentVal)+1);
                                        $("#followBoxPopup").fadeIn(800);
                                        $("#followBleaterBox").html(data);
    		        		
    		        	}
    			}
    		});
    	}
    } 
	
	function submitPoll(pollId, optionId, articleId)
	{	
		
		var postUrl	=	"/article/index/submit-poll";
		datavalue = 'pollId='+pollId+'&optionId='+optionId+'&articleId='+articleId;
		
		$.ajax({
			type: "POST",
			url: postUrl,
			data: datavalue,
			cache: false,
			success: function(data){
				if(data	==	1){
					$("#showPollOption").hide();
					$("#thanks").fadeIn(500);
					$("#thanks-msg").html('You have already voted!')
				}else {
					$("#showPollOption").html(data);
					aid	=	"poll_"+optionId;
					$("a#"+aid).attr('class', 'select');
					$("#showPollOption").hide();
					$("#thanks").fadeIn(500);
					$("#thanks-msg").html('Thank you for rating this outfit!')
				}		        	
			}
		});
	}
	
	function showPoll()
	{
		$("#thanks").hide();
		$("#showPollOption").fadeIn(500);
		
	}

        function closeLikePopup()
        {
            var pathname = window.location;
            
            $("#followBoxPopup").fadeOut(800);
            $("#followbox_overlay").fadeOut(400);
            window.location=pathname;
        }

        function closeLoginPopup()
        {
            $("#loginBoxPopup").fadeOut(800);
            $("#followbox_overlay").fadeOut(400);
        }

        function closeNoThanksPopup()
        {
           $("#followBoxPopup").fadeOut(800);
           $("#followbox_overlay").fadeOut(400);
        }

        function yesPleasePopup(followid, whosefollowing)
        {
            var requesturl   =   "/bleater/bleat/followbleater-pop";
            var followSpanId =   "follow_"+followid;
            //alert(followSpanId);

            $.post(requesturl, {followid:followid, whosefollowing:whosefollowing  },
               function(html){
                    $("#yesPleaseText").hide();
                    $("#noThanksText").show();                   
                    //onclick="return unFollowBleater("'+followid+'","'+ whosefollowing+'","'+ followSpanId+'", /bleater/bleat/unfollowbleater)" href="javascript:void(0);"
                    //$("."+followSpanId).html("<a class='unfollow' >UnFollow</a>");


            });

        }



       

