var searchQ = "";
var match = false;
var searchExp = "";

/*
searchExp = document.referrer.match(/^http:\/\/[^?]*?google\.[^?]+(\?(.*&)?q=([^&]*?)(&.*)?)?$/);
if (searchExp && searchExp != null) {
	searchQ = "&q="+ searchExp[3];
}
*/
if (!match) {
	searchExp = document.referrer.match(/^http:\/\/[^?]*?google\.[^?]+(\?(.*&)?q=([^&#]*?)(&.*)?)?(#.*)?$/);
	if (searchExp && searchExp != null) {
		searchQ = "&q="+ searchExp[3];
		match = true;
	}
}
if (!match) {
	searchExp = document.referrer.match(/^http:\/\/[^?]*?yahoo\.[^?]+(\?(.*&)?p=([^&#]*?)(&.*)?)?(#.*)?$/);
	if (searchExp && searchExp != null) {
		searchQ = "&q="+ searchExp[3];
		match = true;
	}
}
if (!match) {
	searchExp = document.referrer.match(/^http:\/\/[^?]*?altavista\.[^?]+(\?(.*&)?q=([^&#]*?)(&.*)?)?(#.*)?$/);
	if (searchExp && searchExp != null) {
		searchQ = "&q="+ searchExp[3];
		match = true;
	}
}

if (
	top.location.href.indexOf('makettinfo.hu/index.php') == -1
	&& !top.location.href.match(/^(http:\/\/)?(www\.)?makettinfo\.hu\/?$/)
) {
	top.location.href = "/index.php?jobb="+document.location.pathname.substr(1)+"&"+document.location.search.substr(1)+searchQ+"&hash="+document.location.hash.replace('#', '');
	//top.location.href="http://makettinfo.hu/index.php?jobb="+document.location.pathname.substr(1)+"&"+document.location.search.substr(1)+searchQ;
}

/*
if (top.frames['alap'] == null) top.location.href="http://makettinfo.hu/index.php?jobb="+document.location.pathname.substr(1)+"&"+document.location.search.substr(1)+searchQ+document.location.hash;
<script src="/redirect.js" type="text/javascript" charset="utf-8"></script>
*/
