function _flash (version, filename, name, width, height, wmode, flashvars,bgcolor) {
   if (!bgcolor) bgcolor = '#FFFFFF'
  
   var menu    = '';
   document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+version+"' width='"+width+"' height='"+height+"' id='"+name+"' align='middle'>");
   document.write("<param name='FlashVars' value='"+flashvars+"' />");
   document.write("<param name='allowScriptAccess' value='always' />");
   document.write("<param name='wmode' value='"+wmode+"' />");
   document.write("<param name='bgcolor' value='"+bgcolor+"' />");
   document.write("<param name='salign' value='lt' />");
   document.write("<param name='movie' value='"+filename+"' /><param name='quality' value='high' /><embed src='"+filename+"' wmode='"+wmode+"' quality='high' FLashVars='"+flashvars+"' salign='lt' width='"+width+"' height='"+height+"' bgcolor='"+bgcolor+"' name='"+name+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
   document.write("</object>");
} 

function _urf(filename, name, width, height, url, title, bgcolor) {
	
	if (url) {
		 document.write("<a title=\""+title+"\" href=\""+url+"\"><img style=\"border:0;position:absolute;z-index:100;width:"+width+";height:"+height+";\" src=\"/img/blank.gif\"></a>");
	}
	if (bgcolor != '') {
		_flash("8,0,0,0", filename, name, width, height, "opaque", "", bgcolor);
	} else {
		_flash("8,0,0,0", filename, name, width, height, "transparent", "", bgcolor);
	}
	
}

function putTitle(inTitle) {
	_flash("8,0,0,0", "/backend/project/swf/title.swf?txt=" + inTitle, "page_title", '400px', '40px', "transparent", "&txt=" + inTitle + '&', "");
}

function no() {
	
}

function setFGalleryImage(inSrc, inName) {
	document.getElementById('top_name').innerHTML = inName;
	//alert(A_GALLERY_F[inName]['SRC'])
		if (elw.lastCur == inName) {
			document.location = A_GALLERY_F[inName]['URL'];
		}
		elw.lastCur = inName;
		document.getElementById('top_img').src = A_GALLERY_F[inName]['SRC'];
		document.getElementById('top_id').href = A_GALLERY_F[inName]['URL'];	
}

function hiderPreloaderIMG() {
	document.getElementById('gal_preloader').style.display = 'none';
}

$(document).ready(function() {
	$('#sign-btn').toggle(function(){
		$("#loginbox").fadeIn("medium");
		},function(){
			$("#loginbox").fadeOut("medium");
		});
});

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
      return window[movieName]
    } else {
      return document[movieName]
    }
}

function showHideProfSpecInfo(inID) {
	var el = document.getElementById(inID);
	alert(el.style.display)
	if (el.style.display == 'none') {
		el.style.display = '';
	} else {
		el.style.display = 'none';
	}
}

function doPhotoPreview(inID) {
	inID = inID.replace('Z:', '');
	var src = FileUploader.a_files[inID]['PATH'];
	
	bz.alert("<table width=100% height=100%><tr><td style='border:1px solid #eee;background-color:#ccc;vertical-align:middle'><center><img src='" + src + "'></center></td></tr></table>", 400, 400, true) 
	
}

function _imagePress(inID, inLevel) {
	if (inLevel == 0) {
		document.location = A_GALLERY[inID];
	}
	
}

function doPhotoRemove(inID) {
	inID = inID.replace('Z:', '');
	FileUploader.a_files[inID] = false;
	document.getElementById('Z:'+inID).style.visibility = 'hidden';
    document.getElementById('R:'+inID).style.visibility = 'hidden';
}

var ALLOW_SELECT = false;
function disableRightClick(e) {
	if (ALLOW_SELECT) return true;
	if(!document.rightClickDisabled) {
	    if (document.layers) {
			document.captureEvents(Event.MOUSEDOWN);
			document.onmousedown = disableRightClick;
		} else {
			document.oncontextmenu = disableRightClick;
		}
	    return document.rightClickDisabled = true;
	}
	if(document.layers || (document.getElementById && !document.all)) {
	    if (e.which==2 || e.which==3) {
			return false;
		}
	} else {
	    return false;
	}
}
function disableSelection(target){
	if (typeof target.onselectstart!="undefined") //IE route
		target.onselectstart=function(){return ALLOW_SELECT}
	else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
		if (!ALLOW_SELECT) {
			target.style.MozUserSelect="none"
		} else {
			target.style.MozUserSelect="text"
		}
	
	else //All other route (ie: Opera)
		target.onmousedown=function(){return ALLOW_SELECT}
	target.style.cursor = "default"
}
function _setTime(d) {
		var m_names = new Array("January", "February", "March", 
		"April", "May", "June", "July", "August", "September", 
		"October", "November", "December");
		
		var d_names = new Array("Sunday", "Monday", "Tuesday",
		"Wednesday", "Thurstday", "Friday", "Saturday");
		
		var curr_hour = d.getHours();
		
		if (curr_hour < 12) {
		   a_p = "AM";
		} else {
		   a_p = "PM";
		}
	//	if (curr_hour == 0) {
	///	   curr_hour = 12;
	///	}
	//	if (curr_hour > 12) {
	//	   curr_hour = curr_hour - 12;
	//	}
		
		var curr_min = d.getMinutes();
				
		var curr_month = d.getMonth();
			curr_month = m_names[curr_month];
			var curr_date = d.getDate();
			var curr_day = d.getDay();

			var sup = "";
			if (curr_date == 1 || curr_date == 21 || curr_date ==31) {
			   sup = "st";
			} else if (curr_date == 2 || curr_date == 22) {
			   sup = "nd";
			} else if (curr_date == 3 || curr_date == 23) {
			   sup = "rd";
			} else {
			   sup = "th";
			}
	
		if (Number(curr_min) < 10) {
			curr_min = '0' + curr_min;
		}
		
		var el = document.getElementById('weather_time')
		el.innerHTML = curr_hour + '<label id="weather_dots">:</label>' + curr_min;
		var el = document.getElementById('weather_date')
		//Wednesday, 16 December,
		//Wednesday, 16 December,
		
		el.innerHTML = d_names[curr_day] + ",&nbsp;" + curr_date + sup + "&nbsp;" + curr_month + "</span>";
	}
	
	function _doDots() {
		var el = document.getElementById('weather_dots');
		if (el.style.visibility == '') {
			el.style.visibility = 'hidden'
		} else {
			el.style.visibility = '';
		}
	}
	
function doSetProfilePrices(inItem) {
	
	var txt = inItem.options[inItem.selectedIndex].text;
	var letter = '&pound;';
	if (txt == 'EURO') letter = '&euro;'
	if (txt == 'USD') letter = '$'
	for (var x = 0; x < 200; x++) {
	 	var el = document.getElementById('li#' + x);
	 	if (!el) continue;
	 	
	 	el.innerHTML = letter + Math.round(inItem.value * el.getAttribute('ini_val'));
	 	//el.innerHTML = Math.round(inItem.value * el.getAttribute('ini_val'));
	 	
	 }
}
	
function setGalleryImage(inPath, inLet, inPost) {
	document.getElementById('cur_img').innerHTML = inPost;
	var el = document.getElementById('big_photo');
	el.style.display = 'none';
	if (inLet == 'H') {
		el.className = 'horz';
	} else {
		el.className = 'vert';
	}
	el.style.visibility = ''
	el.src = inPath;
}
	

var isIE = document.all; 

function _elw() {
	
	
}

function setDirections(fromAddress, toAddress, locale) {
  gdir.load("from: " + fromAddress + " to: " + toAddress,
            { "locale": locale });
}

var elw = {	
	doSetClass : function (inClass) {
		document.getElementById('a_top').className = inClass;
	},
	
	homeNext : function () {
		var el  = document.getElementById('top_img');
		var src = String(el.src);
		
		var first_name = "";
		var prev_name  = "";
		var res_arr    = "";
		var can_select  = false;
		for (var x in A_GALLERY_F) {
			A_GALLERY_F[x]['NAME'] = x;
			if (first_name == '') {
				first_name = x;
			}
			
			if (can_select) {
				res_arr = A_GALLERY_F[x];
				break;
			}
			
			if (src.indexOf(A_GALLERY_F[x]['SRC']) >= 0) {
				can_select = true;
			}
			
			prev_name = x;
		}
		if (res_arr == '') {
			res_arr = A_GALLERY_F[first_name];
		}
		
		if (res_arr != '') {
			elw.lastCur = res_arr['NAME'];
			document.getElementById('top_img').src = res_arr['SRC'];
			document.getElementById('top_id').href = res_arr['URL'];	
			document.getElementById('top_name').innerHTML = res_arr['NAME'];
		}
		
		thisMovie('galleryf_swf').goNext();
	},
	homePrev : function () {
		var el  = document.getElementById('top_img');
		var src = String(el.src);		
		
		var first_name = "";
		var prev_name  = "";
		var res_arr    = "";
		var can_select  = false;
		for (var x in A_GALLERY_F) {
			A_GALLERY_F[x]['NAME'] = x;
			if (first_name == '') {
				first_name = x;
			}
			
			if (can_select) {
				res_arr = A_GALLERY_F[x];
				break;
			}
			
			if (src.indexOf(A_GALLERY_F[x]['SRC']) >= 0) {
				can_select = true;
			}
			
			if (can_select && prev_name != '') {
				res_arr = A_GALLERY_F[prev_name];
				break;
			}
			
			prev_name = x;
		}
		if (res_arr == '') {
			for (var x in A_GALLERY_F) {
				first_name = x;
			}
			res_arr = A_GALLERY_F[first_name];
		}
		
		if (res_arr != '') {
			elw.lastCur = res_arr['NAME'];
			document.getElementById('top_img').src = res_arr['SRC'];
			document.getElementById('top_id').href = res_arr['URL'];	
			document.getElementById('top_name').innerHTML = res_arr['NAME'];
		}
		
		thisMovie('galleryf_swf').goPrev();
	},
	showSignUp : function () {
		bz.showWin ('/login_page.html', 300, 180); 
	},
	
	registerMember : function () {
		bz.showWin ('/register_member.html', 800, 600); 
	},	
	
	showRoute : function () {
		showRoute(ADD_FROM, ADD_TO);
	},
	
	doCalc : function () {
		var el = document.getElementById('addr_to');
		document.getElementById('show_route').style.display = 'none'
		if (el.value == '' || el.value == el.getAttribute('placeholder')) {
			bz.alert("Please enter correct address and try again.");
			return;
		}
		ADD_TO = el.value + ', UK'

		setDirections(ADD_FROM, el.value + ', UK', "en_US");
	},
	
	doSendForgot : function (inForm) {
		if (!bz.checkForm(inForm)) return false;
		bz.doPostForm('DO_FORGOT', inForm);
	},
	
	setCurrent : function (inItem) {
		if (!elw.lastCur) {
			elw.lastCur = 0;
		}
		var pos = inItem.getAttribute('is_pos');
		if (pos == elw.lastCur) {
			document.location = inItem.alt;
		}
		elw.lastCur = pos;
		document.getElementById('top_img').src = inItem.getAttribute('bsrc');
		document.getElementById('top_name').innerHTML = inItem.getAttribute('name');
		document.getElementById('top_id').href = inItem.getAttribute('alt');
	},

	 
	controlPositions : function () {
		var el  = document.getElementById('gallery_inner');
		if (!el) return;
		var pos = parseInt(el.style.marginLeft);
		var tx  =  Number(el.getAttribute('t_x'));
		
		if (el.getAttribute('t_x')) {
			
			if (tx > pos) {
				pos = pos + 4;
				el.style.marginLeft = pos + 'px';
			}
			if (tx < pos) {
				pos = pos - 4;
				el.style.marginLeft = pos + 'px';
			}		
			
			if (tx == pos) {
				elw.moveDisable = false;
			}
			
		}
	}
	
}

setInterval('elw.controlPositions()', 20);

var LAST_SWF_URL = '';
function doShowDetails(inID) {
	//document.getElementById('dtl_addr').innerHTML = A_GALLERY_DTL[inID]['ADR']
	document.getElementById('dtl_addr').innerHTML = A_GALLERY_DTL[inID]['ADR'];
	document.getElementById('dtl_price').innerHTML = A_GALLERY_DTL[inID]['PRC'];
	/*
	if (Number(A_GALLERY_DTL[inID]['DSC'])) {
		document.getElementById('dtl_desc').innerHTML = 'Overnight Special From 9pm to 7 am £' + A_GALLERY_DTL[inID]['DSC'];
	} else {
		document.getElementById('dtl_desc').innerHTML = A_GALLERY_DTL[inID]['DSC'];
	}
	document.getElementById('partner_dual').innerHTML = "<p>unavailable</p>";
	if (A_GALLERY_DTL[inID]['DSC'] !== '' && A_GALLERY_DTL[inID]['DSC'] != '&nbsp;') {
		document.getElementById('dynamic').style.visibility = ''
	} else {
		document.getElementById('dynamic').style.visibility = 'hidden'
	}
	*/
	LAST_SWF_URL = A_GALLERY_DTL[inID]['URL']
}



function goToSWFProfile() {
	if (LAST_SWF_URL != '') {
		document.location = LAST_SWF_URL;
	}
}

function swfNext() {
	thisMovie('gallery_swf').goNext();
}

function swfPrev() {
	thisMovie('gallery_swf').goPrev();
}

function swfStop() {
	thisMovie('gallery_swf').doStop();
}

var bz = {
	 doAfterPost : function (inStr) {
	 	try {
	 		var arr = eval ('(' + inStr + ')');
	 	} catch (e) {
	 		alert(inStr);
	 		return;
	 	}
	 	if (arr['STATUS'] != 'OK') {
	 		if (arr['DESC']) {
	 			bz.alert(arr['DESC']);
	 			return false;
	 		}
	 		if (arr['DES']) {
	 			bz.alert(arr['DES']);
	 			return false;
	 		}	 		
	 	} else {
	 		if (arr["URL"]) {
	 			document.location = arr['URL'];
	 			return;
	 		}
	 		if (arr['CLEAR']) {
	 			bz.clearForm(arr['CLEAR'])
	 		}
		 		
	 		if (arr["ALERT"]) {
	 			bz.alert(arr['ALERT']);
	 		}	
	 		if (arr["DESC"]) {
	 			bz.alert(arr['DESC']);
	 		}	
	 		if (arr["FUN"]) {
	 			var tmp = arr["FUN"] + "(arr)";
	 			eval(tmp);
	 		}	 			 		 
 				
	 	}
	 },
	 doPost : function (inURL,inArr) {
		if (inURL.indexOf('/') < 0) {
			inURL = '/public/index.php?AJ_OP=' + inURL;
		}	 	
	 		 	
	 	var inBack = bz.doAfterPost;
	 	
		if(window.XMLHttpRequest){
		var http = new XMLHttpRequest( );
		} else if (window.ActiveXObject){
		var http=new ActiveXObject("Msxml2.XMLHTTP");
		if (! http){
		var http=new ActiveXObject("Microsoft.XMLHTTP");
		}
		}	
		var url = inURL;
		var params = '';
		inArr['AJAX_REQUEST'] = 'Y';
		for (var x in inArr) {
			params +=x+'='+encodeURIComponent(inArr[x])+'&';
		} 
		params = params.replace(/%20/g, "+")
		http.open("POST", url, true);
		http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		http.onreadystatechange = function() {
			if(http.readyState == 4 && http.status == 200) {
				inBack(http.responseText);
			}
		}
		http.send(params);
	},
	
	clearForm : function (inForm) {
		if (typeof(inForm) != 'object') {
			inForm = document.getElementById(inForm);
		}
		for( var i = 0; i < inForm.elements.length; i++) { 
			  var el = inForm.elements[i];
			  if (el.type == 'radio') continue;
			  if (el.type == 'checkbox') continue;
			  if (el.type == 'submit') continue;
			  
			  el.value = '';
		}
		bz.setPlaceHolders(inForm);
	},
	
	fillSelect : function (inItem, inArr) {
		for (var x in inArr) {
			inItem.options.length++;
	    	inItem.options[inItem.options.length-1].value = x;
			inItem.options[inItem.options.length-1].text = inArr[x];	
		}
	},
	
	clearSelect : function (inItem) {
		while (inItem.options.length!=0) {
		if(inItem.options && inItem.options.remove)
			inItem.options.remove(0);
		else if(inItem.remove)
			inItem.remove(0);
		else inItem.options[0]=null;
		}
	},
	
	doPostForm : function (inURL,inForm, inArr) {
		var a_processed_radio = {};
		if (typeof(inForm) != 'object') {
			inForm = document.getElementById(inForm);
		}
		var arr = {};
			
		
		for( var i = 0; i < inForm.elements.length; i++) { 
			var id = inForm.elements[i].id.split(':')[0];
			if (id.indexOf('#') > 0 )continue;

		   var el = inForm.elements[i];
		   if (id == '') {
		    	var id = inForm.elements[i].name;
		   }
		   if (el.id.indexOf(':month') > 0 || el.id.indexOf(':day') > 0) continue;
		   if (el.id.indexOf(':year') > 0) {
		   		arr[id] = bz.getDateValue(id);
		   		continue;
		   }
		   if (el.type == 'radio' && a_processed_radio[id]) continue;
		   if (el.type == 'radio') {
		   		a_processed_radio[id] = true;
		   		arr[id] = bz.getRadioValue(inForm,id);
		   		continue;
		   }
		   if (el.type == 'checkbox' && a_processed_radio[id]) continue;
		   if (el.type == 'checkbox') {
		   		a_processed_radio[id] = true;
		   		arr[id] = bz.getCheckValue(inForm,id);
		   		continue;
		   }		   
		   
		   var tmp_el = document.getElementById(id+'#IMG_VIEW');
		   if (tmp_el) {
		   		arr[id] = String(tmp_el.src); 
		   		continue;
		   }
		   
		   arr[id] = inForm.elements[i].value;
		}
		if (inArr) {
			for (var x in inArr) {
				arr[x] = inArr[x];
			}
		}
		if (inURL.indexOf('/') < 0) {
			inURL = '/ajax_operation/?AJ_OP=' + inURL;
		}
		
		bz.doPost(inURL, arr);
		return true;	
	},
	getRadioValue : function (inForm,inID) {
		var arr = bz.getAllRadioItems(inForm,inID);
		for (var x in arr) {
			if (arr[x].checked) {
				if (arr[x].value == '') arr[x].value = 'Y';
				return arr[x].value;
			}
		}
		return "";
	},
	getCheckValue : function (inForm,inID) {
		if (inID.indexOf(':') < 0) {
			if (document.getElementById(inID).checked) {
				return document.getElementById(inID).value;
			} else {
				return '';
			}
		}
		var arr = bz.getAllRadioItems(inForm,inID);
		var res = "";
		for (var x in arr) {
			if (arr[x].checked) {
				res += arr[x].value + ',';
			}
		}
		return res;
	},	
	doSearch : function (inKey, inAddr, inType, inCat) {
		if (!inType) inType = 'all';
		if (!inAddr) inAddr = 'everywhere';
		if (!inCat) inCat   = 'all_cats';
		if (!inKey) inKey   = '-';
		
		document.location = "/public/search/"+inType+"/data/loc/" + escape(inAddr) + '/kw/' + escape(inKey) + '/cat/' + inCat;
	},
	getAllRadioItems : function (inForm,inID) {
		var arr = {};
		for( var i = 0; i < inForm.elements.length; i++) { 
		   var id = inForm.elements[i].id;
		   var el = inForm.elements[i];
		   if ((el.type != 'radio' && el.type != 'checkbox') || el.id.indexOf(inID + ':') < 0) continue
		   arr[id] = el;
		}
		return arr;
	},
	ec : function (inID) {
		if (!bz.ecItems) bz.ecItems = {};			
		if (!bz.ecProc)  bz.ecProc  = {};			
			
		if (bz.ecProc[inID]) return;
		
		bz.ecItems[inID] = {};
		
		for (var x = 0; x < 1000; x++) {
			var el = document.getElementById(inID+'#'+x);
			if (!el) break;
			bz.ecItems[inID][x] = el;
		}
		
		bz.ecProc[inID] = setInterval('bz.ecProcess("' + inID+'")', 30);

	},
	
	ecProcess : function (inID) {
		 
		for (var x in bz.ecItems[inID]) {
			var el = bz.ecItems[inID][x];
			if (el == -1) continue;
			if (el.style.display == '') {
				el.style.display = 'none'
			} else {
				el.style.display = ''
			}
			 bz.ecItems[inID][x] = -1;
			
			 return;
		}
		
		clearInterval(bz.ecProc[inID]);
		bz.ecProc[inID] = false;
		
	},
	
	onFocus : function (inItem) {
		inItem.style.backgroundColor = "#fcfdbf";
		if (!inItem.getAttribute('bzSet')) {
			inItem.setAttribute('bzSet', 'Y');
			bz.addListener(inItem, 'blur', new Function ("bz.onBlur(this)"))
		}
	},
	
	onBlur : function (inItem) {
		inItem.style.backgroundColor = "";
	},
		
	getClientSize : function (){
		if(document.compatMode=='CSS1Compat')
			return [document.documentElement.clientWidth, document.documentElement.clientHeight];
		else
			return [document.body.clientWidth, document.body.clientHeight];
	},
	getDocumentScroll : function(){
		return [
		self.pageXOffset || (document.documentElement && document.documentElement.scrollLeft) 
			|| (document.body && document.body.scrollLeft),
		self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) 
			|| (document.body && document.body.scrollTop)
		];
	},
	getCenter : function (){
		var sizes = bz.getClientSize();
		var scrl  = bz.getDocumentScroll();
		return [parseInt(sizes[0]/2)+scrl[0], parseInt(sizes[1]/2)+scrl[1]];
	},	
	
showItem : function (inID, inTime) {
		if (inTime == 0) {
			document.getElementById(inID).style.display = '';
			return;
		} else {
			if (!bz.showArr) {
				bz.showArr = {};
				bz.showTrp = {};
			}
			clearInterval(bz.showArr[inID]);
			bz.bz(inID, 0);
			document.getElementById(inID).style.display = '';
			bz.showArr[inID] = setInterval('bz.addOpacity("' + inID +'", 10)', inTime / 10 );
			
		}
	},	
	
	bz : function (inID, inVal, addToBefore) {
		if (!addToBefore) {
			bz.showTrp[inID] = inVal;
		}
		var el = document.getElementById(inID);
		if (!isIE) {
			inVal = inVal / 100;
			if (addToBefore) {
				inVal += Number(el.style.opacity);
			}
			if (inVal > 1 || inVal < 0) {
				if (inVal < 0) {
					inVal = 0;
					el.style.display = 'none';
				} else {
					inVal = 1;
				}
				el.style.opacity = inVal;
				clearInterval(bz.showArr[inID])
				return;
			} else {
				el.style.opacity = inVal;
			}
			
		} else {
			if (addToBefore) {
				inVal = bz.showTrp[inID] + inVal;
				bz.showTrp[inID] = inVal;
			}
			
			if (inVal > 100 || inVal < 0) {
				if(inVal < 0) {
					inVal = 0;
					el.style.display = 'none';
				} else {
					inVal = 100;
				}
				
				el.style.filter="progid:DXImageTransform.Microsoft.Alpha(Opacity="+inVal+", Style=0)";
				clearInterval(bz.showArr[inID]);
				bz.showTrp[inID] = inVal;
				return;
			} else {
				el.style.filter="progid:DXImageTransform.Microsoft.Alpha(Opacity="+inVal+", Style=0)";
			}
		}
	},

	hideItem : function (inID, inTime) {
		if (inTime == 0) {
			document.getElementById(inID).style.display = 'none';
			return;
		} else {
			if (!bz.showArr) {
				bz.showArr = {};
				bz.showTrp = {};
			}
			clearInterval(bz.showArr[inID]);
		//	bz.bz(inID, 0);
			document.getElementById(inID).style.display = '';
			bz.showArr[inID] = setInterval('bz.addOpacity("' + inID +'", -10)', inTime / 10 );
			
		}
	},		
	
	addOpacity : function (inID, inDif) {
		bz.bz (inID, inDif, true);
	},	
	
	showPopup : function(pageURL, title,w,h) {
		var left = (screen.width/2)-(w/2);
		var top = (screen.height/2)-(h/2);
		var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
	}, 	
	
	showWin : function (inURL, inW, inH) {
		bz.alert("<iframe frameborder=\"NO\" style='width:100%;height:100%;' src='"+inURL+"'></iframe>", inW, inH, true);
	},
	
	closeWin : function () {
		bz.hideItem('FU__alert', 200);bz.blockWin(false);
	},
		
	alert : function(inStr, inW, inH, notEffectHtml) {
			if (!inW) inW = 450;
			if (!inH) inH = 200;

			var arr = bz.blockWin(true);
			var el = document.getElementById('FU__alert');
			
			if (!el) {
				var el  = document.createElement("DIV");
					el.id = 'FU__alert'
					el.style.left = '0px';
					el.style.top  = '0px' 
					el.style.position = 'absolute';
					el.style.zIndex = '100000';
					
								
					el.style.display = 'none';
					document.body.appendChild(el);	
	
					 						
			}
			
			bz._blDiv.onclick = new Function ("bz.hideItem('FU__alert', 200);bz.blockWin(false)");
			
			el.style.width  = inW+'px';
			el.style.height = inH+'px';
			
			el.style.left = Number(arr[0] - inW/2) + 'px';
			el.style.top  = Number(arr[1] - inH/2) + 'px';		
	
			
			
			var inHtml = inStr;
				
			var FU_THEME_PATH = '/public/images/v1/t1/';
			
			if (!notEffectHtml) {
					var html = "<!--IFRAME--><div class=\"dialog-box\" id=\"dialog-alert\">";
					html += "<div class=\"dialog-box-top\">";
					html += "<div class=\"dialog-box-content\">";
					html += "<a href=\"javascript:bz.closeAlert();\" class=\"btn-dialog-close\" title=\"Close\"></a>";
					html += "<div class=\"sign info-sign\">";
					html += "<p class=\"title\"></p>";
					html += "<p>"+inStr+"<br/><br/></p>";
					html += "</div>";
					html += "<table width=\"100%\">";
					html += "<tr>";
					html += "<td>&nbsp;</td>";
					html += "<td>&nbsp;</td>";		
					html += "<td style=\"padding-right:50px\"><a class=\"d_ok_btn\" href=\"javascript:bz.closeAlert()\">1</a></td>";
					html += "<td>&nbsp;</td>";
					html += "<td>&nbsp;</td>";
					html += "</tr>";
					html += "</table></div></div></div>";
				
				
				var str = html;//"<div style=\"vertical-align:middle;widht:300px;height:200px;border:1px solid red;background-color:#fff\"><p>"+inStr+"</p></div>";
			} else {
				var str = "<div style=\"vertical-align:middle;widht:"+inW+"px;height:"+inH+"px;border:1px solid red;background-color:#fff\">"+inStr+"</div>";;
			}

			el.innerHTML = str;
			bz.showItem('FU__alert', 400)	
	},		
	
	closeAlert : function () {
		bz.closeWin();
		if (bz.altFun) {
			bz.altFun();
		}
	},	
	
	blockWin : function (show){
		bz._show = show;
		if (show && bz.onResize) {
			bz.onResize(show)
		}
		if(bz._blDiv==null){
			bz._blDiv=document.createElement('DIV');
			with(bz._blDiv.style){
				display='none'; 
				position='fixed'; 
				height=0; width=0;	
				zIndex=10000; 
				if(isIE){
					backgroundColor = '#000';
					filter="progid:DXImageTransform.Microsoft.Alpha(Opacity=20, Style=0)";
				}
				else 
					backgroundColor = '#000';
					opacity = 0.2;
			}
			bz._blDiv.id = '__block_div'
			document.body.appendChild(bz._blDiv);
		}
		if(show){
			
			bz._blDiv.style.left    = 0;
			bz._blDiv.style.top     = 0;
			bz._blDiv.style.width   = '100%';
			bz._blDiv.style.height  = '100%';
			bz._blDiv.style.display = 'block';
		} else {
			bz._blDiv.style.display = 'none';			
		}

		return bz.getCenter();
	},	
	
	
	addListener : function(element, type, expression, bubbling) {
	bubbling = bubbling || false;
	if(window.addEventListener) { // Standard
		element.addEventListener(type, expression, bubbling);
		return true;
	} else if(window.attachEvent) { // IE
		element.attachEvent('on' + type, expression);
	return true;
	} else return false;
	},
	
	getDateValue : function (inID) {
		var year  = document.getElementById(inID + ':year').value;	
		var month = document.getElementById(inID + ':month').value;	
		var day   = document.getElementById(inID + ':day').value;

		if (!Number(day) || !Number(month) || !Number(year)) return '';
		return year+'-'+month+'-'+day;
	},
	
	setPlaceHolders : function (inForm) {
		if (typeof(inForm) != 'object') {
			inForm = document.getElementById(inForm);
		}
		for( var i = 0; i < inForm.elements.length; i++) { 
			var el = inForm.elements[i];
			if (el.getAttribute('placeholder')) {
				if (el.value == '') {
					el.value = el.getAttribute('placeholder');
					el.style.color = '#ccc'
				}
				if (el.getAttribute('phDone') != 'Y') {
					bz.addListener(el, 'focus', new Function ("bz.phFocus('"+el.id+"')"));
					bz.addListener(el, 'blur', new Function ("bz.phBlur('"+el.id+"')"));
					el.setAttribute('phDone', 'Y')
				}
			}
		}		
		
	},
	
	phFocus : function (inItem) {
		inItem = document.getElementById(inItem);
		if (inItem.value == inItem.getAttribute('placeholder')) {
			inItem.value = '';
			inItem.style.color = 'black'
		}
	},
	
	phBlur : function (inItem) {
		inItem = document.getElementById(inItem);
		if (inItem.value == '' && inItem.getAttribute('placeholder')) {
			inItem.style.color = '#ccc'
			inItem.value = inItem.getAttribute('placeholder');			
		}
	},	
	
	checkForm : function (inForm) {
		if (typeof(inForm) != 'object') {
			inForm = document.getElementById(inForm);
		}

		var a_tmp = {};
		for( var i = 0; i < inForm.elements.length; i++) { 
			a_tmp[inForm.elements[i].id] = inForm.elements[i];
		}
		
		for( var i = 0; i < inForm.elements.length; i++) { 
		   var id = inForm.elements[i].id;
		   if (id == '') {
		    	var id = inForm.elements[i].name;
		   }
		   if (id.indexOf(':month') > 0 || id.indexOf(':day') > 0) continue;
		   var el = inForm.elements[i];
		 
		   if (el.id.indexOf(':year') > 0) {
			   // -- check reck
			   var date = bz.getDateValue(el.id.split(':')[0]);

		   		if (date == '' && el.getAttribute('jsReq') == 'Y') {
			   		//usMsg.showInfo("Date is not correct", el, 'RIGHT');
			   		return false;
		   		}
		   		// --- check date correctness
		   		var a_tmp = date.split('-')
		   		var msg = isDate(a_tmp[1]+'/'+a_tmp[2]+'/'+a_tmp[0]);
		   		if (msg != '') {
			   		//usMsg.showInfo('Date is not correct', el, 'RIGHT');
			   		return false;
		   		}
		   }
		   
		   if (el.type == 'radio' && bz.getRadioValue(inForm, el.id.split(':')[0]) == '') {
		   			bz.alert("You did not fill all required fields. Please check item<b>" + el.name + "</b> and try again.");
		   		return false;			
		   }
		   if (el.getAttribute('jsReq') == 'Y' && (el.value == '' || el.value == el.getAttribute('placeholder'))) {
		   		bz.alert("You did not fill all required fields. Please enter value into <b>" + el.name + "</b> and try again.");
		   		return false;	
		   }
		   if (el.type == 'password' && a_tmp[el.id+'#'] && el.value != a_tmp[el.id+'#'].value) {
		   		bz.alert(el.name)
		   		return false;	
		   }
		   // EMAIL
		   if (el.id.toUpperCase().indexOf('EMAIL') >= 0 && el.value != '') {
		   		if (!bz.checkEmail(el.value)) {
		   			bz.alert("You entered incorrect value into <b>" + el.name + "</b> field. You should enter correct Email Address here. Please correct it and try again.");
		   			return false;
		   		}
		   }
		}

		return true;	
	},
	
	checkEmail : function(inputvalue){	
   		var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/;  
		return emailPattern.test(inputvalue);  
    },
    
    checkDate : function (inItem) {
    	//alert(inItem.id)
    }

}
