 /************************************************ DropDown menu ****************************/
 $(document).ready(function(){					
		$(" .menubtn ul ").css({display: "none"}); // Opera Fix
		$(" .menubtn li").hover(function(){
			$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
			$(this).find('a').addClass('used-btn');
			},function(){
			$(this).find('ul:first').css({visibility: "hidden"});
			$(this).find('a').removeClass('used-btn');
		});
	});

/************************************************ Change Homepage Background ****************************/
function changeBackground(alinkid){
	var index = $("#thumbNav a").index($(alinkid));
	$('#backgroundcont').attr('class','background'+index);
}
/*function changeBackgroundImg(alinkimg){
	var index = $("#thumbNav a").index($(alinkid));
	$('backgroundcont').attr('style', 'background-image :..Library/Images/BG/' & alinkimg);
}*/
/************************************************ Accordion *********************************************/
$(document).ready(function() {
    $(".accordion div:first").hide();
    $(".accordion div:not(:first)").hide();
    $(".accordion a").click(function() {
        $(this).next("div").slideToggle("slow")
		.siblings("div:visible").slideUp("slow");
        $(this).toggleClass("active");
        $(this).siblings("a").removeClass("active");
    });
});

$(document).ready(function() {
    //$(".accordion2 div:first").hide();
    $(".accordion2 div:not(:first)").hide();
    $(".accordion2 a").click(function() {
        $(this).next("div").slideToggle("slow")
		.siblings("div:visible").slideUp("slow");
        $(this).toggleClass("active2");
        $(this).siblings("a").removeClass("active2");
    });
});

$(document).ready(function() {
    $(".accordion3 div.packagescontent:first").hide();
    $(".accordion3 div.packagescontent:not(:first)").hide();
    $(".accordion3 a").click(function() {
        $(this).next("div.packagescontent").slideToggle("slow")
		//.siblings("div.packagescontent:visible").slideUp("slow");
        $(this).toggleClass("active3");
        //$(this).siblings("a.packageslinkhead").removeClass("active2");
    });
	//Fix table layout
	$('.generalTable table').attr('border', 0);
	$('.generalTable table').attr('cellpadding', 0);
	$('.generalTable table').attr('cellspacing', 0);
	$('.generalTable table').attr('width', '100%');
	$('.contenttbl').each(function(){
		$(this).find('tr:first').addClass('tablhead');
	})
});

function MM_findObj(n, d) {
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}


function ValidateSearch(source, args) {
    if (document.location.href.indexOf("index") > -1) {

        if (MM_findObj('ControlHead1_ControlTopMenu1_txtSearchAll').value.length < 3) {
            args.IsValid = false;
        }
        else {
            args.IsValid = true;
        }
    }
    else {

        if (MM_findObj('ctl00_ControlHead1_ControlTopMenu1_txtSearchAll').value.length < 3)
            args.IsValid = false;
        else
            args.IsValid = true;
    }
}

function print_function(){     
	var disp_setting="toolbar=no,location=no,directories=no,menubar=no,";
	disp_setting+="scrollbars=yes,width=610, height=400, left=100, top=100";
	var content_value = document.getElementById("contentToPrint").innerHTML;
	var content_title = document.getElementById("titleToPrint").innerHTML;
	var docprint=window.open("","",disp_setting);
	docprint.document.open();
	docprint.document.write('<html><head><title>Nakhal</title>');
	docprint.document.write('<link rel="stylesheet" type="text/css" href="styles/nakhal.css" media="all" /></head><body onLoad="javascript:self.print(); self.close();">');
	docprint.document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td style="padding:0 10px;"><div style="border-bottom:1px solid #000; padding-bottom:7px; margin-bottom:15px;" class="subpagetitle">'+content_title+'</div></td></tr><tr><td style="padding:0 10px 10px 10px; font-size:13px;" class="subcentercont contentcont">'+content_value+'</td></tr></table>');
	docprint.document.write('</body></html>');
	docprint.document.close(); 
 	docprint.focus();
}

function facebookShare(location, title) {
    u = location;
    t = title;
    window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436');
    return false;
}
