function confirmURL(questStr, url) {
	goToUrl = confirm(questStr);
	if(goToUrl) {
		location.href = url;
	}
	return false
}

function openWin(url,w,h) {
	window.open(url,'tmp_win','width='+w+' height='+h)
	return false;
}

function setCookie(name, value, expires, path, domain, secure) {
  var defaultexpires = new Date();
  defaultexpires.setTime(defaultexpires.getTime());
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

function addHTML (html) {
	if (document.all)
		document.body.insertAdjacentHTML('beforeEnd', html);
	else if (document.createRange) {
		var range = document.createRange();
		range.setStartAfter(document.body.lastChild);
		var docFrag = range.createContextualFragment(html);
		document.body.appendChild(docFrag);
	} else if (document.layers) {
		var l = new Layer(window.innerWidth);
		l.document.open();
		l.document.write(html);
		l.document.close();
		l.top = document.height;
		document.height += l.document.height;
		l.visibility = 'show';
	}
}


function insertAfter(parent, node, referenceNode) {
	parent.insertBefore(node, referenceNode.nextSibling);
}

function closeSplash() {
	var splash = document.getElementById('splash')
	splash.style.display = 'none'
}

function splash() {
	var content = '<div style="position:absolute; top:250; left:250; width:450; height:310; z-index:5; background:#EEEEE6; display:show; border:1px #000000 solid" id="splash" align="left">'
	content += '<table cellpadding=10><tr><td><font size="+0">Welcome to preSex. We sell condoms, lubricants and sexual preparations. All orders made week days before 15.00 are shipping from us the same day and will be recived within 2-3 working days. We accept orders from <b>all EU-countries</b>.<br><br>Best Regards<br>preSex.'
	content += '<br><br><a href="#" onClick="return closeSplash()"><h3>Close</h3></a></td></tr></table>'
	content += '</div>'
	if(getCookie('splashEU')!='1') {
		setCookie('splashEU','1','','/','','')
		addHTML(content)
	}
}

//addLoadEvent(new Function('splash()'))

$(document).ready(function() {
    $(".admlanglink").click(function() {
    	$(".admlang").hide();	
    	$(".lang"+this.rel).show();
    }); 
    $(".admCatlanglink").click(function() {
    	$(".admCategory").hide();
    	$(".clang"+this.rel).show();
    });
    $(".admSubCatlanglink").click(function() {
    	$(".admSubCategory").hide();	
    	$(".slang"+this.rel).show();
    });
    $("#sep-ad-chk").click(function() {
    	$(".sep-ad").toggle();
    });
    $(".unpaied").click(function() {
    	$("#a"+this.rel).toggle();
    	return false;
    });
});

