jQuery.noConflict();	
jQuery(document).ready(function(){
	jQuery("#subSendReq").click(function(){
		if( chekContactForm() ){
			jQuery("#frmContactUs").submit();
		}	
	});
	jQuery(".addMewBtn a").click(function(){
		jQuery("#popup").show();
		return false;
	});
	jQuery("#popupeditClose").click(function(){			
		jQuery("#popup_edit").fadeOut("slow");
		return false;
	});
	
	jQuery(".editProfileBtn").click(function(){
		jQuery("#profile").show();
		return false;
	});	
	jQuery("#profileClose").click(function(){
		jQuery("#profile").fadeOut("slow");		
		return false;
	});
	
	// Edit Profile 
	
	jQuery(".editProfileBtn").click(function(){
		jQuery("#editProfile").show();
		return false;
	});
	
	jQuery("#popupClose").click(function(){
		jQuery(this).parent().fadeOut("slow");
		return false;
	});
	
	jQuery("#closeEdit").click(function(){
		jQuery("#editProfile").fadeOut("slow");
		return false;
	});
	
	jQuery("#btnSave").click(function(){
		jQuery("#TestimoyAddForm").submit();
		jQuery("#testimonyBody").fadeOut("slow");
		return false;
	});
	
	jQuery("#popupClose2").click(function(){
		jQuery(this).parent().fadeOut("slow");		
		return false;
	});
	
	
	jQuery("#popupClose_edit").click(function(){
		jQuery(this).parent().parent().hide();
		return false;
	});
	
	// Width Control Of Custom Browse Button
	jQuery("#uploadUserThumb").css("width","48px");
	
	
	// 
	jQuery(".testomonialsEvent p a:contains('Testimony')").click(function(){
		jQuery(".commonPopup2").show();
		return false;
	});
	
	jQuery(".category span b a:contains('testimony')").click(function(){
		jQuery(".commonPopup2").show();
		return false;
	});
	
	jQuery(".commonPopupClose").click(function(){
		jQuery(this).parent().fadeOut();
		return false;
	});
	
	//commonPopupClose2
	
	jQuery(".commonPopupClose2").live("click",function(){
		jQuery(this).parent().fadeOut();
		return false;
	});
	
	jQuery(".testomonialsEvent p a:contains('Edit')").click(function(){
		jQuery(".commonPopup3").show();
		return false;
	});
	
	jQuery(".testomonialsEvent p a:contains('View')").click(function(){
		jQuery(".commonPopup3").show();
		return false;
	});
	
});



function ajax_call(id,url)
{	
	jQuery.ajax({
            type: 'POST',
            url: url,
            data: "pid="+id, 			
            success: function(data){				
               jQuery("#popup_edit").html(data);			   
            },
            error: function(message){               			
            }
        });
		jQuery("#popup_edit").show();
}

jQuery(document).ready(function(){
	//hide the all of the element with class msg_body
	jQuery(".msg_body").hide();
	//toggle the componenet with class msg_body
	jQuery(".msg_head").click(function(){
		jQuery(this).next(".msg_body").slideToggle(250);
	});
});


function expand(divname)
{
   //    alert(document.getElementById(divname).style.display);
	if(document.getElementById(divname).style.display=='none')
	jQuery("#"+divname).show("fast");
	else if(document.getElementById(divname).style.display=='block')
	jQuery("#"+divname).hide("fast");
}
function collaps(divname)
{
	jQuery("#"+divname).hide("fast");
}

function prapedia_add(url)
{
	jQuery.ajax({
            type: 'POST',
            url: url,
            data: "pid=1", 			
            success: function(data){				
               jQuery("#add_prapedia").html(data);			   
            },
            error: function(message){               			
            }
        });
		jQuery("#add_prapedia").show();
}

function prapedia_edit(id,url)
{	
	jQuery.ajax({
            type: 'POST',
            url: url,
            data: "pid="+id,
            success: function(data){				
               jQuery("#add_prapedia").html(data);			   
            },
            error: function(message){               			
            }
        });
		jQuery("#add_prapedia").show();
}
////////////////////////////////////////trim/////////////////// 


function checkemail(str){ 
 
 var filter=/^.+@.+\..{2,3}/
	if (filter.test(str))
		return true;
	 else {   
		return false
	}
}


function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+", "g"), "");
}
/////////////////////////////////////////////
function chekContactForm()
{
	//uname,
	//email,description
	if(trim(document.getElementById('uname').value," ").length==0)
	{
		jQuery("#desMsg").hide();				
		jQuery("#emailMsg").hide();
		jQuery("#unameMsg").show();
		return false;
	}
	if(checkemail(trim(document.getElementById('email').value," "))==false)
	{
		jQuery("#unameMsg").hide();				
		jQuery("#desMsg").hide();
		jQuery("#emailMsg").show();
		return false;
	}
	
	if(trim(document.getElementById('description').value," ").length==0)
	{
		jQuery("#unameMsg").hide();				
		jQuery("#emailMsg").hide();
		jQuery("#desMsg").show();
		return false;
	}	
	return true;
}

