$(document).ready(function(){

	var query = self.location.search;
	var href = document.location.href;
	rkvScript.isFamily = (href.indexOf("/familie/")>-1);
	var iframeObj = rkvScript.$('myframe');
	sammlung = new Array();
	//rkvScript.log("hasTarifSelection: " + window.hasTarifSelection);
	if (window.hasTarifSelection == true && query == ''){
		//rkvScript.log("kein OAM");
	}else{
		if (query != ''){
			query = query.substr(1, query.length - 1);
			query = query.replace(/%26/,'&');
			teile = query.split('&');
			for (i = 0; i < teile.length; i++){
				teile[i] = teile[i].split('=');
				window[teile[i][0]] = teile[i][1];
				//rkvScript.log("Name: " + teile[i][0]);
				//rkvScript.log("Wert: " +window[teile[i][0]]);
				//rkvScript.log("test: " + window['appid']);
			}
				
			if (teile[0][0] != "tarifWahl"){ // parameter is nicht tarifWahl, also wird OAM mit parametern aufgerufen
				//rkvScript.log("document.location.href: " + document.location.href);
				window.iframeUrl = "/oam/" + tarif + appid + "/antragsteller.do;jsessionid="+session;
				//rkvScript.log("test: " + iframeUrl);
			}else{
				//  parameter tarifWahl gefunden, also wird regularer Iframe für ARE oder AVF aufgerufen
/**
* mapping of appids:
* Version A: ARE = 10205 | AVF = 10210
* Version B: ARE = 10207 | AVF = 10212
*/
				if(teile[1][1] == "b"){ // parameter version ist b (= neue Version)
					if (teile[0][1] == "AVF") window.iframeUrl = "/oam?appid=10212&ta=AVF&keyword=auslandsreiseversicherung&rendernavi=false";
					else window.iframeUrl = "/oam?appid=10207&ta=ARE&keyword=auslandsreiseversicherung&rendernavi=false";
				}else{ // parameter version ist a (= alte Version)
					if (teile[0][1] == "AVF") window.iframeUrl = "/oam?appid=10210&ta=AVF&keyword=auslandsreiseversicherung&rendernavi=false";
					else window.iframeUrl = "/oam?appid=10205&ta=ARE&keyword=auslandsreiseversicherung&rendernavi=false";
				}
			}
				
		}
			/*else{
				if (rkvScript.isFamily){ // show AVF
					window.iframeUrl = "/oam?appid=10212&ta=AVF&keyword=auslandsreiseversicherung&rendernavi=false";
				}else { //show ARE
					window.iframeUrl = "/oam?appid=10207&ta=ARE&keyword=auslandsreiseversicherung&rendernavi=false";
				}
			}*/
		iframeObj.src = iframeUrl;
		
		// reduce opacity of content
		$('.contentbox').addClass('contentboxInactive');
	}
		
})