﻿/*
 *   This file runs on every page, every time they are loaded. Do not remove it, it's a core file.
 *
 */

$(function(){
	$("input.date").datepicker();
	$(".labeler").labeler();
	$("#content input, .popup input").typeClass("input_type");
	$(".odd").oddEven();
	$(".ui_tabs").tabs();
	$(".slidingpane").slidingPane();
	$(".afalc").afalc();
	$(".row").columns();
	$(".thumb_wrap").tooltiper({animateEffect:"slide", position:"center top", showDelay:150, offset: [0, 10]});
	$(".listing tbody tr").hoverClass();
});
 
// Open an AJAX dialog
function openDialog(url,title,width,height) {
	$("#dialog").dialog('destroy'); 
	// Fetch content
	$.ajax({
	   type: "GET",
	   url: url,
	   data: "ajax=1",
	   success: function(data){
		   $("#dialog").html(data);
		   $("#dialog").show();
	   }
	});
	// Set up dialog
	$("#dialog").dialog({
		width: 500,
		height: 300,
		modal: true,
		title: title,
		cache: false,
		overlay: { background: "#000", opacity: 0.3 }
	}); 
	}
 
function SelectTemplate(templateID) {
	var highlightClassName = "image_highlight_wrap";
	var parentItem = "a";
	var imageObject = $("#img_" + templateID);
	$("#img_" + $("#hdnSelectedTemplateID").val()).parent(parentItem).removeClass(highlightClassName);
	if(imageObject.parent(parentItem).attr("class")!=highlightClassName) {
		imageObject.parent(parentItem).addClass(highlightClassName);
		$("#hdnSelectedTemplateID").val(templateID);
	}
}
