// Enumeration for most popular browser types
var BrowserAgents = {IE6:0, IE7:1, IE7plus:2, IE:3, Firefox:4, Opera:5, Other:6};
// This function returns the user's browser type
function GetBrowserAgent()
{
if (navigator.userAgent.indexOf("MSIE") >= 0)
{
// If Internet Explorer then check the version
var sVer = navigator.userAgent;
sVer = sVer.substring(sVer.indexOf("MSIE") + 5, sVer.indexOf("MSIE") + 6);
sVer = new Number(sVer);
if (sVer < 6)
{
return BrowserAgents.IE;
}
else if (sVer == 6)
{
return BrowserAgents.IE6;
}
else if (sVer == 7)
{
return BrowserAgents.IE7;
}
else
{
return BrowserAgents.IE7plus;
}
}
else if (navigator.userAgent.indexOf("Firefox"))
{
return BrowserAgents.Firefox;
}
else if (navigator.userAgent.indexOf("Opera"))
{
return BrowserAgents.Opera;
}
else
{
return BrowserTypes.Other;
}
}
//Hides and shows elements
function hide_show(hide_element, show_element)
{
if(document.getElementById(hide_element) != null)
document.getElementById(hide_element).style.display = "none";
if(document.getElementById(show_element) != null)
document.getElementById(show_element).style.display = "";
}
function LoadStyle(a_id)
{
if(Cookie.read('HideSearchFilters') == 'true')
{
hide_show(a_id, 'spanShowElement');
}
else
{
hide_show('spanShowElement', a_id);
}
}
function Write(value)
{
Cookie.write('HideSearchFilters', value, {duration: 1});
}
//Checks the radio button passed as parameter
function CheckRadioButton(rButton)
{
document.getElementById(rButton).checked = true;
}
//hides or shows the sender and changes the arrow of the image. We use this function for the filters --> ucSearchFilters.ascx
function hideOrShow(sender)
{
var node = sender; //gets the sender
do
{
node = node.nextSibling; //search all other nodes that are under the sender (not child nodes)
}while(node.className != 'pnlFilters'); //this is our node that we are looking for - the panel that holds the gridView
var elemToHideShow = node.id; //the ID of the element to hide or show
node = sender.childNodes[0]; //sets the node as the first child node of the sender
while(node.className != 'imgArrow') //looks through all child nodes of the sender to find the image that we must change
{
node = node.nextSibling;
}
var imageToChangeID = node.id; //the id of the image to change
if(document.getElementById(elemToHideShow).style.display == "none")
{
document.getElementById(elemToHideShow).style.display = "inline";
document.getElementById(imageToChangeID).src = "Images/arrow-down.gif";
}
else
{
document.getElementById(elemToHideShow).style.display = "none";
document.getElementById(imageToChangeID).src = "Images/arrow-up.gif";
}
}
/*hides or shows panel*/
function hideShowPanel_LoadStyle(panel)
{
if(document.getElementById(panel).style.display == "none")
{
document.getElementById(panel).style.display = "";
}
else
{
document.getElementById(panel).style.display = "none";
}
}
/*changes the control CssClass between the two classes, passed as parameter*/
function changeCssClass(controlID, firstCssClass, secondCssClass)
{
if(document.getElementById(controlID).className == firstCssClass)
{
document.getElementById(controlID).className = secondCssClass;
}
else
{
document.getElementById(controlID).className = firstCssClass;
}
}
function validateEmail(e, textBoxToValidate, errorLabel)
{
var reg = /^([A-Za-z0-9_\-\.\+])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address = document.getElementById(textBoxToValidate).value;
if(reg.test(address) == false)
{
document.getElementById(errorLabel).className = "nothidden"
if(window.event)
{
e.returnValue = false;
}
else
{
e.preventDefault();
}
}
else
{
document.getElementById(errorLabel).className = "hidden noDisplay";
}
}
/*Shroud an email address in a spam secure way - http://support.website-creator.org/avoid_spam.html*/
function writeEmail(username, hostname)
{
var linktext = username + "@" + hostname ;
document.write("" + linktext + "");
}
/*sets current day, month or year on onfocus event*/
function onFocusSet(dmy, control)
{
var d = new Date();
if(dmy == 'day')
{
if (control.value == (d.getDate() + 1)) {control.value = '';}
}
else if(dmy == 'month')
{
if (control.value == (d.getMonth() + 1)) {control.value = '';}
}
else if(dmy == 'year')
{
if (control.value == d.getFullYear()) {control.value = '';}
}
}
/*sets current day, month or year on onBlur event*/
function onBlurSet(dmy, control)
{
var d = new Date();
if(dmy == 'day')
{
if (control.value == '') {control.value = (d.getDate() + 1);}
}
else if(dmy == 'month')
{
if (control.value == '') {control.value = (d.getMonth() + 1);}
}
else if(dmy == 'year')
{
if (control.value == '') {control.value = d.getFullYear();}
}
}
/*hides the specified control, passed by it's ID */
function hideControl(a_oControlID)
{
var obj = document.getElementById(a_oControlID);
obj.style.display = "none";
}
/*Changes the background of the textbox control with the value of the textbox*/
function ChangeBGColor(control)
{
document.getElementById(control).style.backgroundColor = document.getElementById(control).value;
}
function fixIframesInIE7(a_sPanelID)
{
document.getElementById(a_sPanelID).innerHTML += '
';
}
/* Branded View Stuff - Uncomment when in Branding Mode*/
/*
(function ($) {
$('html').on('click', function (e) {
if (!$(e.target).is('input')) {
var bannerClick = true;
$('.noBrand').each(function () {
var content = jQuery(this);
var left = content.offset().left - 2;
var right = left + content.width() + 2;
var top = content.offset().top - 2;
var bottom = top + content.height() + 2;
if (e.pageX > left && e.pageX < right
&& e.pageY > top && e.pageY < bottom) {
bannerClick = false;
}
});
if (bannerClick) {
window.open('http://ads.buljobs.bg/www/delivery/ck.php?oaparams=2__bannerid=97__zoneid=35__cb=f8b1d8ae02__oadest=http%3A%2F%2Fwww.buljobs.bg%2Fbooking%2Fworkingatbooking.html', '_blank');
}
}
}).css('cursor', 'pointer');
$(document).ready(function () {
$('.noBrand').each(function () { $(this).css('cursor', 'default'); });
});
}(jQuery));
*/