$(document).ready(function() {						   	
	if($(".ckdetails").html()) {
		if($.rc4DecryptStr($(".ckdetails").html(),"")=="<br />\n") {
			$(".ckdetails").html("<span class='error'>Content not available</span>");
		} else {
			$(".ckdetails").html($.rc4DecryptStr($(".ckdetails").html(),""));
		}
		
		$(".ckdetails").css("display","block");
	}
	if($("a[class^=pirobox]").attr("class")) {
		$().piroBox({
				my_speed: 300,
				bg_alpha: 0.5,
				radius: 4,
				pirobox_next : 'piro_next',
				pirobox_prev : 'piro_prev',
				close_all : '.piro_close,.piro_overlay',
				slideShow : 'slideshow',
				slideSpeed : 3
		});
	}
	
});
function bootFun() {

	if(page && page != "home"){
		document.getElementById("main_menu").style.height="1.55em";
	}else{
		document.getElementById("main_menu").style.height="19px";	
	}
	
	
}
/* Menu Start */

function showSubcategory(menu_id,product) {
	var count = $("#main_menu_count").val();
	for(var i=2;i<=(count-1);i++){
		
		document.getElementById("submain"+i).style.display = "none";
	}
	if(document.getElementById("submain"+menu_id).style.display == "inline"){
		$("div#submain"+menu_id).fadeOut("slow");
	
	}else{
		$("div#submain"+menu_id).fadeIn("slow");	
	}
	
	/*
	var count = $("#main_menu_count").val();
	$("#menu_product").val(product);
	for(var i=1;i<=count;i++){
		$("#main"+i).removeClass();
		$("#main"+i).addClass("navitab");
		
		//$("#submenu"+i).fadeOut("slow");
		
	}
	$("#main"+menu_id).removeClass();
	$("#main"+menu_id).addClass("menu-select");
	
	location.href=base_path+"index.php?page=page-content&mpid="+product;

	
	//$("#mainsubmenu").fadeIn("slow");
	*/
}
/*
function showSubcategory(menu_id,product) {
	var count = $("#main_menu_count").val();
	for(var i=2;i<(count-1);i++){
		document.getElementById("submain"+i).style.display = "none";	
	}
	if(document.getElementById("submain"+menu_id).style.display == "inline"){
		$("div#submain"+menu_id).fadeOut("slow");
	
	}else{
		$("div#submain"+menu_id).fadeIn("slow");	
	}
	
	
}
*/
function showOMouseSubcategory(menu_id,product) {
	var count = $("#main_menu_count").val();
	for(var i=2;i<(count-1);i++){
		document.getElementById("submain"+i).style.display = "none";
	}
	if(document.getElementById("submain"+menu_id).style.display == "inline"){
		$("div#submain"+menu_id).fadeOut("slow");
	
	}else{
		$("div#submain"+menu_id).fadeIn("slow");	
	}
	
	
}
function hideMenu(){
	var count = $("#main_menu_count").val();
	for(var i=2;i<=(count-1);i++){
		
		document.getElementById("submain"+i).style.display = "none";	
	}
}
function showOtherMenu(menu_name) {
		$("#menu_product").val(menu_name);
		if(menu_name == "home" || !menu_name){
			location.href=base_path;
		}
		if(menu_name == "contactus"){
			location.href=base_path+"contact-us";
		}
		var count = $("#main_menu_count").val();
		
		
}

/* Menu End */

function showCategoryMenu(id){
	if(document.getElementById(id).style.display == "none"){
		$("#"+id).fadeIn("slow");	
	}else{
		$("#"+id).fadeOut("slow");	
	}
}
function showSubcategoryFun(id){
	if(document.getElementById(id).style.display == "none"){
		$("#"+id).fadeIn("slow");	
	}else{
		$("#"+id).fadeOut("slow");	
	}
}
function pageContent(id){
	location.href=base_path+"category/"+id;
}
function sendContactUs() {
	var flag = true;
	$("#result").html("");
	var allId="name`email`mobile`message";
	clearForm('', allId,"");	
	var norId = allId;
	var funId = "email`mobile";
	var valFun = "vemail`vtelephone";
	
	flag = checkValidation(norId,funId,valFun);	
	var value = getData(allId);
	if(flag) {		
		$.ajax({
			type: "POST",
			url: base_path+"ajax_redirect.php?page="+page+"&option=sendContactUs",
			dataType: "html",
			data: "data="+value,
			beforeSend: function() {
				callProcessing();
			},
			success: function(data) {
				$("#result").html(data);
				//setTimeout("location.href='"+base_path+"contact-us'",700);
			}			
 		});
	} else {
		$("#result").html("<span class='error'>"+ajax_misfield+"</span>");	
	}	
}
function callProcessing() {
	$("#result").html("<span><img src='"+base_path+"images/loader.gif' class='imgLoader' alt='' /></span>");		
}
