/**
 * jQuery Cookie plugin
 *
 * Copyright (c) 2010 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
jQuery.cookie = function (key, value, options) {

    // key and at least value given, set cookie...
    if (arguments.length > 1 && String(value) !== "[object Object]") {
        options = jQuery.extend({}, options);

        if (value === null || value === undefined) {
            options.expires = -1;
        }

        if (typeof options.expires === 'number') {
            var days = options.expires, t = options.expires = new Date();
            t.setDate(t.getDate() + days);
        }

        value = String(value);

        return (document.cookie = [
            encodeURIComponent(key), '=',
            options.raw ? value : encodeURIComponent(value),
            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            options.path ? '; path=' + options.path : '',
            options.domain ? '; domain=' + options.domain : '',
            options.secure ? '; secure' : ''
        ].join(''));
    }

    // key and possibly options given, get cookie...
    options = value || {};
    var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};

function setCookie(c_name,value,exdays) {
	var exdate=new Date();
	exdate.setDate(exdate.getDate() + exdays);
	var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
	document.cookie=c_name + "=" + c_value;
}

function getCookie(c_name) {
	var i,x,y,ARRcookies=document.cookie.split(";");
	for (i=0;i<ARRcookies.length;i++)
	{
	  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
	  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
	  x=x.replace(/^\s+|\s+$/g,"");
	  if (x==c_name)
		{
		return unescape(y);
		}
	  }
}
	
//make sure noconflict mode
jQuery.noConflict();
jQuery(function($){
	var dock_height = "150"
	var body_height = $(window).height() - dock_height
	$('body').append('<div id="bottom-ad" style="display: none;" ><span id="close-bottom-form" style="display: block; cursor: pointer; position: absolute; right: 50px; top: 10px; color: #fff; display: inline-block; padding: 0px 10px 2px; border: 1px solid #4081AF; border-bottom-color: #20559A; color: white !important;			text-align: center; text-shadow: 0 -1px 0 rgba(0, 0, 0, .3); text-decoration: none; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px;			background: #237FD7; background: -webkit-gradient( linear, left top, left bottom, color-stop(.2, #52A8E8), color-stop(1, #2E76CF) ); background: -moz-linear-gradient( center top, #52A8E8 20%, #2E76CF 100% ); -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3) /*Top*/, inset 0 0 2px rgba(255, 255, 255, .3) /*Shine*/, 0 1px 2px rgba(0, 0, 0, .29) /*Shadow*/; -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3) /*Top*/, inset 0 0 2px rgba(255, 255, 255, .3) /*Shine*/, 0 1px 2px rgba(0, 0, 0, .29) /*Shadow*/; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3) /*Top*/, inset 0 0 2px rgba(255, 255, 255, .3) /*Shine*/, 0 1px 2px rgba(0, 0, 0, .29) /*Shadow*/; cursor: pointer;">x</span><iframe src="http://awebsitedesigner.com.au/downloads/seo-domination.php" border="0" style="border: 0; width: 100%;" scrolling="no"></iframe></div>');
	if ( getCookie ( 'ad-bottom' ) != 'hidden' ) {
		$('#bottom-ad').css({'height' : '0', 'position' : 'fixed', 'bottom' : 0, 'width' : '100%', 'z-index' : '1000', 'display' : 'block'}).delay(2000).animate({ height : '+=' + dock_height });
	}
	$('#close-bottom-form').click(function(){
		setCookie ( 'ad-bottom', 'hidden', 5);
		$('#bottom-ad').fadeOut('fast');
	});
	$(window).resize(function(){
		var updated_height = $(window).height() - dock_height;
		$('#bottom-ad').css('top', updated_height);
	});
	setCookie ( 'ad-bottom', 'hidden', 5);
	
	
});

