function LoadSWFmain(movie, width, height, id) {


	
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="'+id+'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width+'" height="'+height+'">\n');
	document.write('<param name="allowScriptAccess" value="sameDomain">')
	document.write('<param name="movie" value="'+movie+'">\n');
	document.write('<param name="quality" value="high">\n');
	document.write('<param name="menu" value="false">\n');
	document.write('<param name="scale" value="noscale">\n');
	document.write('<param name="salign" value="lt">\n');
	document.write('<param name="wmode" value="transparent">\n');	
	document.write('<param name="bgcolor" value="#ffffff">');
	document.write('<embed src="'+movie+'" width="'+width+'" height="'+height+'"  name="'+id+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"  scale="noscale"  salign="lt" wmode="transparent"></embed>\n');
	document.write('</object>\n');

	
} 

function swapIMG(obj, url) {
	obj.src=url;
}

function searchProceed() {
	var property_type = document.getElementById('property_type_options').value;
	var location = document.getElementById('location_options').value;
	var transaction = document.getElementById('transaction_options').value;
	var price = document.getElementById('price_options').value;
	
	var url = 'index.php5?mod=oferty&op=1&location='+location+'&property_type='+property_type+'&transaction='+transaction+'&price='+price;
	
	return url;
}


function fadeEfectClass(b) {
	
	this.changeOpac = changeOpac;
	this.fadeIn = fadeIn;
	this.fadeOut = fadeOut;
	
	var b = b;
	var opcaityTimer1;
	var opcaityTimer2;
	var opacityN = 1;
	
	function changeOpac(opacity, id, newOpacity) {
	    var object = document.getElementById(id).style;
	 try {   object.opacity = (opacity / 100); } catch (e) { }
	 try {   object.MozOpacity = (opacity / 100);} catch (e) { }
	 try {   object.KhtmlOpacity = (opacity / 100);} catch (e) { }
	 try {   object.filter = "alpha(opacity=" + opacity + ")";} catch (e) { }
	
	 if(newOpacity) opacityN = newOpacity;
	
	}
	
	
	function fadeIn(id, callback) { 
		if(opacityN < 100) { 
			clearTimeout(opcaityTimer2);
			opacityN = opacityN+10;
			changeOpac(opacityN, id);
			opcaityTimer1 = setTimeout(b+'.fadeIn(\''+id+'\', \''+callback+'\')', 15);
		} else {
			if (callback) eval(callback);
		}
	}
	
	function fadeOut(id, callback) { 
		if(opacityN > 9) {
			clearTimeout(opcaityTimer1);
			opacityN = opacityN-10;
			changeOpac(opacityN, id);
			opcaityTimer2 = setTimeout(b+'.fadeOut(\''+id+'\', \''+callback+'\')', 15);
		} else {
			//alert('fadedOut');
			if (callback)  eval(callback);
		}
	}
}

b1 = new fadeEfectClass('b1');
b2 = new fadeEfectClass('b2');
b3 = new fadeEfectClass('b3');
b4 = new fadeEfectClass('b4');
mainAlphaObj = new fadeEfectClass('mainAlphaObj');
multiAlphaObj = new fadeEfectClass('multiAlphaObj');
boxAlphaObj = new fadeEfectClass('boxAlphaObj');



function switchOnMark(n) {
	name = 'mark' + n;
	mark_on = 'mark.jpg';
	document.getElementById(name).src = 'image/' + mark_on;
}

function switchOffMark(n) {
	name = 'mark' + n;
	mark_off = 'mark_off.jpg';
	document.getElementById(name).src = 'image/' + mark_off;
}

function removeWhitespace(xml) {
	var loopIndex;
	
	for (loopIndex = 0; loopIndex < xml.childNodes.length; loopIndex++) {
		var currentNode = xml.childNodes[loopIndex];
		if (currentNode.nodeType == 1) {
			removeWhitespace(currentNode);
			}
		if (((/^\s+$/.test(currentNode.nodeValue))) && (currentNode.nodeType == 3)) {
			xml.removeChild(xml.childNodes[loopIndex--]);
		}
	}
	return xml;
}

var mozillaFlag = false;
function CreateHttpObj() {
		
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_object = new XMLHttpRequest();
		mozillaFlag = true;
		if (http_object.overrideMimeType) {
			//http_object.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_object = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_object = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
            }
        }
	
	if (!http_object) {
            alert('XMLHTTP Error');
            return false;
	} else {
		return 	http_object;
	}
	
}

function getURLVar(urlVarName) {
	//divide the URL in half at the '?'
	var urlHalves = String(document.location).split('?');
	var urlVarValue = '';
		if(urlHalves[1]){
		//load all the name/value pairs into an array
		var urlVars = urlHalves[1].split('&');
		//loop over the list, and find the specified url variable
			for(i=0; i<=(urlVars.length); i++){
				if(urlVars[i]){
				//load the name/value pair into an array
				var urlVarPair = urlVars[i].split('=');
				if (urlVarPair[0] && urlVarPair[0] == urlVarName) {
				//I found a variable that matches, load it's value into the return variable
				urlVarValue = urlVarPair[1];
				}
			}
		}
	}
	return urlVarValue;   
}

function printOffer(id) {
	url = 'index.php5?mod=offer&op=3&id='+id;
	x = window.open(url,'name','height=570,width=720');
	if (window.focus) x.focus();
}


