if (typeof _LTE_IE8_ === 'undefined') var _LTE_IE8_ = false;
if (typeof _IE8_ === 'undefined') var _IE8_ = false;

function navSearchBar_editFocused(form) {
	var v = form['kwords'];
	if (v.value=="Search")
		v.value="";
}

function navSearchBar_btnClicked(form) {
	var v = form['kwords'];
	return v.value!="" && v.value!="Search";
}

function browseMenu_more_onClick(e,id) {
	var pnl = arpt.getWidget(id);
	if (!pnl) {		
		$id(id).style.display = "block";
		pnl = new YAHOO.widget.Panel(id, { 
			width:"520px", height:"300px", close:true, visible:false, iframe:false,
			underlay:"shadow", modal:true, zindex:9999, constraintoviewport:true 
		});
		pnl.render(document.body);
		arpt.putWidget( id, pnl );
	}
	pnl.center();
	pnl.show();
}

function open_ssl_seal() {
	var w = window.open("https://sealinfo.verisign.com/splash?form_file=fdf/splash.fdf&dn=www.okobe.co.uk&lang=en", "win", "status=1,toolbar=0,menubar=1,scrollbars=1,resizable=1,directories=0,width=520,height=460");
	w.focus();
}

var addthis_config = {
	username: "okobe",
	services_exclude: "amazonwishlist"
};

// Category Navigational Menu.
//
function initCatNavMenu() {
	
}

CatNavMenu = function(cfg) {
	this.init(cfg);
};

function initPage() {
    window.onload = addCorners();
}
    
function addCorners(classname)  {
    var a = []; 
    var els = document.getElementsByTagName("body")[0].getElementsByTagName("*");
    
    for( var i=0,j=els.length; i<j; i++ ) {
    	if (els[i].className.indexof("rounded")==0)
        	a.push(els[i]);
    }
    
	for (var i=0; i<a.length; i++) {
        var tl = document.createElement('div');tl.className="tl";
        var tr = document.createElement('div');tr.className="tr";
        var bl = document.createElement('div');bl.className="bl";
        var br = document.createElement('div');br.className="br";
        a[i].insertBefore(br, a[i].firstChild);
        a[i].insertBefore(br, bl);
        a[i].insertBefore(tr, br);
        a[i].insertBefore(tl, tr);
    }
}

var initNavMenuBar = function() {
    this.buttons = 0;
    this.buttonPrefix = 0;
    this.curButton = -1;
    this.domNode = null;
	this.menu = null;
	this.ctimer = null;
	this.iframe = null;
	
	this.init = function(cfg) {
		this.buttons = 0;
    	this.domNode = $id("navMenuBar");
		this.setupMenuHooks();
	};

	this.setupMenuHooks = function() {
		var tags = $className("navCatMenuCntr","div",this.domNode);
    	YAHOO.Event.addListener(tags, 'mouseout', this.onMouseOut, this, true );
		YAHOO.Event.addListener(tags, 'mouseover', this.cancelTimer, this, true);
			 
		var tags = $className("navTabItem","li",this.domNode);
		YAHOO.Event.addListener(tags, 'mouseover', this.onMouseOver, this, true);
		YAHOO.Event.addListener(tags, 'mouseout', this.onMouseOut, this, true);

        var UA = YAHOO.env.ua;
		if (UA.ie == 6) {
			this.iframe = $new("iframe");
			this.iframe.frameborder="1";
			this.iframe.border="1";
			this.iframe.style.borderWidth="1";
			this.iframe.id = "navCatMenuCntrIframe";
	        document.body.insertBefore(this.iframe, document.body.firstChild);
		}
	};
	
	this.cancelTimer = function() {
        if (this.ctimer) {  
            clearTimeout(this.ctimer);
            this.ctimer = null;
        }
	};
	
	this.onMouseOver = function(ev) {
		var li = this._getTarget(ev);
		var items = $className("navCatMenuCntr","div",li);
		if (items.length) {
			var div = items[0];
			this.cancelTimer();
			
			if (this.menu != div) {
				this.closeMenu();
				this.menu = div;
				var $div = $(div);
				var $li = $(li);
				var $cntr = $('div.pageContent');
				var rx = $cntr.position().left + $cntr.width() - 10;
				
				var cx = $div.width();
				var cy = $div.height();
				var x = $li.position().left;
				if (x+cx >= rx) {
					x -= ((x+cx)-rx);
				}
				$div.css('left',x);
				$div.css('display', "block");
				
				if (this.iframe) {
					div.style.visibility='hidden';
					this.iframe.style.width=cx+"px";
					this.iframe.style.height=cy+"px";
					this.iframe.style.visibility='visible';
					YAHOO.Dom.setXY( this.iframe, YAHOO.Dom.getXY(div) );
					div.style.visibility='visible';
				}
			}			
		}
	};
	
	this.onMouseOut = function(ev) {
        var self = this;
		this.cancelTimer();
        this.ctimer = setTimeout( function() { self.closeMenu(); }, 100 );
	};
	
	this.closeMenu = function() {
		if (this.menu) {
			YAHOO.Dom.setStyle(this.menu, "display", "none");
			this.menu = null;
		}
		if (this.iframe) {
			this.iframe.style.visibility='hidden';
		}
	};
	
    this._getTarget = function(ev) {
		var t = YAHOO.util.Event.getTarget(ev);
		return (t.tagName.toLowerCase()=="li" ? t : $parent(t,"li"));
    };
    
	
	this.init();
};


if (_LTE_IE8_) {
	/*! HTML5 Shiv v3 | @jon_neal @afarkas @rem | MIT/GPL2 Licensed */
	(function (win, doc) {
	// feature detection: whether the browser supports unknown elements
	var supportsUnknownElements = (function (a) {
	a.innerHTML = '<x-element></x-element>';
	return a.childNodes.length === 1;
	})(doc.createElement('a'));
	
	// feature detection: whether the browser supports default html5 styles
	var supportsHtml5Styles = (function (nav, docEl, compStyle) {
	docEl.appendChild(nav);
	return (compStyle = (compStyle ? compStyle(nav) : nav.currentStyle).display) && docEl.removeChild(nav) && compStyle === 'block';
	})(doc.createElement('nav'), doc.documentElement, win.getComputedStyle);
	
	// html5 global so that more elements can be shived and also so that existing shiving can be detected on iframes
	// more elements can be added and shived with the following code: html5.elements.push('element-name'); shivDocument(document);
	var html5 = {
	// a list of html5 elements
	elements: 'abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' '),
	
	// the shiv function
	shivDocument: function (scopeDocument) {
	scopeDocument = scopeDocument || doc;
	
	// test if the document has already been shived
	if (scopeDocument.documentShived) {
	return;
	}
	scopeDocument.documentShived = true;
	
	// set local variables
	var
	documentCreateElement = scopeDocument.createElement,
	documentCreateDocumentFragment = scopeDocument.createDocumentFragment,
	documentHead = scopeDocument.getElementsByTagName('head')[0],
	documentCreateElementReplaceFunction = function (m) {
	documentCreateElement(m);
	};
	
	// shiv for unknown elements
	if (!supportsUnknownElements) {
	// shiv the document
	html5.elements.join(' ').replace(/\w+/g, documentCreateElementReplaceFunction);
	
	// shiv document create element function
	scopeDocument.createElement = function (nodeName) {
	var element = documentCreateElement(nodeName);
	if (element.canHaveChildren){
	html5.shivDocument(element.document);
	}
	return element;
	};
	
	// shiv document create element function
	scopeDocument.createDocumentFragment = function () {
	return html5.shivDocument(documentCreateDocumentFragment());
	};
	}
	
	// shiv for default html5 styles
	if (!supportsHtml5Styles && documentHead) {
	var div = documentCreateElement('div');
	div.innerHTML = ['x<style>',
	'article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}', // Corrects block display not defined in IE6/7/8/9
	'audio{display:none}', // Corrects audio display not defined in IE6/7/8/9
	'canvas,video{display:inline-block;*display:inline;*zoom:1}', // Corrects canvas and video display not defined in IE6/7/8/9 (audio[controls] in IE7)
	'[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}', // Corrects 'hidden' attribute and audio[controls] display not present in IE7/8/9
	'mark{background:#FF0;color:#000}', // Addresses styling not present in IE6/7/8/9
	'</style>'].join('');
	documentHead.insertBefore(div.lastChild, documentHead.firstChild);
	}
	
	// return document (for potential chaining)
	return scopeDocument;
	}
	};
	
	// shiv the document
	html5.shivDocument(doc);
	
	win.html5 = html5;
	})(this, document);
	/* -- END -- HTML5 Shiv v3 | @jon_neal @afarkas @rem | MIT/GPL2 Licensed */
}

$(document).ready( function() {
	//$.getScript('//connect.facebook.net/en_US/all.js#xfbml=1', function() {
	//	FB.init( {appId: '213670875336952', status: true, cookie: true, xfbml: true} );  
	//} );
	//$.getScript('//platform.twitter.com/widgets.js');
} );

