// jQuery custom functions
/*$(function() {
	$("#jq_select").selectbox();
});
*/
$(function(){
	$('.sf-menu').superfish().find('ul').bgIframe({opacity:false});
});
/*
$(function() {
	$("#suggest1").autocomplete('pcsearch.php', {
		matchContains: true,
		width: 225,
		autoFill: false,
		minChars: 0
	});
});
*/
$(function() {
	$('#frmUserSave').formValidation({
		alias			: 'name'
		,required	: 'accept'
		,err_list	:	true
		,err_class : 'invalid'
		,err_message : '<h1>Incomplete Form!</h1><p>Please fill all required fields! (Marked with red borders)</p><ul>'
	});
});

$(function() {
	$('#sendmenow').formValidation({
		alias			: 'name'
		,required	: 'accept'
		,err_list	:	true
		,err_class : 'invalid'
		,err_message : '<h1>Incomplete Form!</h1><p>Please fill all required fields! (Marked with red borders)</p><ul>'
	});
});


function callback() {
	return confirm("Click OK to submit form or Cancel to Abort!");
	}

$(function(){ 
 $('.starz').rating();
});

/*$(function(){
 $('.hover-star').rating({
  focus: function(value, link){
    var tip = $('#hover-test');
    tip[0].data = tip[0].data || tip.html();
    tip.html(link.title || 'value: '+value);
  },
  blur: function(value, link){
    var tip = $('#hover-test');
    $('#hover-test').html(tip[0].data || '');
  },
callback: function(value, link){
    xajax_RateMe(value, xajax.getFormValues('hiddenf'));
  }
 });
});*/


$(function(){
 $('.hover-star').rating({
callback: function(value, link){
    xajax_RateMe(value, xajax.getFormValues('hiddenf'));
  }
 });
});

function wrongLoginMsg()
{
	if ($("#loginErrorsdiv").is(":hidden")) 
	{
		$("#loginErrorMsg").html('<h1>Incorrect Login Details!</h1><p>Either the Username or the Password you have used is wrong...</p>');
		$("#loginErrorsdiv").slideDown("slow");
	}
	else 
	{
		$("#loginErrorsdiv").slideUp("slow");
		$("#loginErrorMsg").html('<h1>Incorrect Login Details!</h1><p>The Username or the Password you have supplied <u>is still wrong</u>...</p>');
		$("#loginErrorsdiv").slideDown("slow");
	}
}

function ResetPass()
{
	if ($("#Passdiv").is(":hidden")) 
	{
		$("#Passdiv").slideDown("slow");
	}
	else 
	{
		$("#Passdiv").slideUp("slow");
	}
}



function multipleUserMsg(email)
{
	if ($("#formErrorsdiv").is(":hidden")) 
	{
		$("#formErrorMsg").html('<h1>Warning!</h1><p>The Email Address (<strong>' + email + '</strong>) already exists in our database...</p><p>Please try a different email address...</p>');
		$("#formErrorsdiv").slideDown("slow");
	}
	else 
	{
		$("#formErrorsdiv").slideUp("slow");
		$("#formErrorMsg").html('<h1>Warning!</h1><p>The Email Address (<strong>' + email + '</strong>) already exists in our database...</p><p>Please try a different email address...</p>');
		$("#formErrorsdiv").slideDown("slow");
	}
}

function forgotPass()
{
	if ($("#forgottenHolder").is(":hidden")) 
	{
		$("#forgottenHolder").slideDown("slow");
		$("#ForgetClick").html('I remembered it - I want to Sign In');
		$("#loginHolder").slideUp("slow");
	}
	else 
	{
		$("#forgottenHolder").slideUp("slow");
		$("#ForgetClick").html('Forgotten your password?');
		$("#loginHolder").slideDown("slow");
	}
}

function logonEnter(event)
{
	if(event.keyCode == 13)
	{
		xajax_checkLogin(xajax.getFormValues('login'), '/pages/profile.htm');
	}
}


$(document).ready(function (){
	$("#category").mcDropdown("#categorymenu", {
		targetColumnSize: 1,
		showACOnEmptyFocus: true,
		//allowParentSelect: true,
		select: function (){xajax_ClosestStore(xajax.getFormValues('locatorForm'))} 
	});
});

// NEW FUNCTIONS FOR soCMS
function href(hlink)
{
	window.location = hlink;
}

function isConfirmed(message)
{
	var c = confirm(message);
	return c;	
}

function editProfile(UserID)
{
	document.getElementById('pEmail').disabled = false;
	document.getElementById('pEmail').style.backgroundColor = '#eee';
	document.getElementById('pFirstname').disabled = false;
	document.getElementById('pFirstname').style.backgroundColor = '#eee';
	document.getElementById('pLastname').disabled = false;
	document.getElementById('pLastname').style.backgroundColor = '#eee';
	document.getElementById('profileEditButton').innerHTML = '<button class="icon" type="button" onclick="xajax_updateProfile(xajax.getFormValues(\'updateProfile\'), ' + UserID + ');;" title="Save Changes"><img style="position: relative; top: 1px;" src="admin/media/buttons/save.png" alt="Save" /></button>';
}

// Some Class
function FCKCollect()
{
	this.UpdateEditorFormValue = function()
	{
		for ( i = 0; i < parent.frames.length; ++i )
		if ( parent.frames[i].FCK )
		parent.frames[i].FCK.UpdateLinkedField();
	}
}
// instantiate the class
var FCKCollector = new FCKCollect();

function printMe()
// Simple Function to print the current Page as is
{
	var a = window.open('','','scrollbars=yes,width=750,height=450');
	
	var title = $("#pageTitle").attr("alt");

	a.document.open("text/html");
	a.document.write('<html><head><link type="text/css" rel="Stylesheet" media="all" href="http://www.oceanbasket.com/assets/css/styles.css" /><style type="text/css">div{background-image:none;background-color:#FFFFFF;} </style>');
	a.document.write('</head><body style="overflow-y: auto; overflow-x: hidden; padding-bottom:10px; background-image:none;background-color:#FFFFFF;">');	
	a.document.write('<h1>' + title + '</h1><hr/>');
	a.document.write($('#printMe').html());
	a.document.write('<br style="clear: both;"/><hr/><em>Source : Ocean Basket (http://www.oceanbasket.com)</em>');
	a.document.write('<div align="center" style="margin-top: 30px; margin-bottom: 30px;">');
	a.document.write('<a href="#" onclick="javascript:window.close();" style="font: normal 10px Verdana;">Close Window</a></div>');
	a.document.write('</body></html>');
	a.document.close();
	a.print();
}

function checkType()
{
	if($("#Type_of_Enquiry").val() == "Complaints and Compliments")
	{
		if ($("#StoreNamediv").is(":hidden")) 
		{
			$("#StoreNamediv").slideDown("slow");
		}
	}
	else 
	{
		if ($("#StoreNamediv").is(":visible")) 
		{
			$("#StoreNamediv").slideUp("slow");
		}
	}
}



