// agenda specific javascript

var bufchecked='';
function bufch(id) {
	o = $('svc_'+bufchecked);
	if(o) {
		o.checked = false;	
	}
	bufchecked = id;
}

function popcontact(rrid) {

	url = '/ajproc/ajpopcontact/?inf__rrid='+rrid;
	
	modal_centered = new Control.Modal(
		$('modal-centered-anchor'),
		{iframe: true,position: 'absolute',containerClassName: 'popcenter',overlayClassName: 'popcenter',width: 700, height: 375,iframeTemplate: new Template('<iframe src='+url+' width=\'100%\' height=\'100%\' frameborder=\'0\' id=\'#popcontact\'></iframe>')}
		);
	modal_centered.open();
	return false;
}

function rfi_notloggedin(nexturl) {
	// login popup. on successful goto the rfi page.	

	url = '/ajproc/ajpoplogin/?actionmode=rfi&nexturl='+encodeURIComponent(nexturl);
	
	modal_centered = new Control.Modal(
		$('modal-centered-anchor'),
		{iframe: true,position: 'absolute',containerClassName: 'popcenter',overlayClassName: 'popcenter',width: 400, height: 200,iframeTemplate: new Template('<iframe src='+url+' width=\'100%\' height=\'100%\' frameborder=\'0\' id=\'#savepopup\'></iframe>')}
		);
	modal_centered.open();
	return false;
}

function ajchangeperm(permid, status) {
	(status==true) ? status = 1 : status = 0;
	s8_simple_callback('/ajproc/ajchangeperm?status='+status+'&permid='+permid, 'after_ajchangeperm');
}
function after_ajchangeperm() {
	// nothing.	
}
function removesavedlistings() {
	s8_simple_callbackform('/ajproc/removesavedlistings', 'savedlistingform', 'after_removesavedlistings', 'Removing Listings, Please Wait...', 'centered');		
}
function after_removesavedlistings() {
	s8_modal_center_show('Refreshing Page...');	
	window.location = '/account/managelistings';
}

function removesavedrfis() {
	s8_simple_callbackform('/ajproc/removesavedrfis', 'savedrfiform', 'after_removesavedrfis', 'Removing RFIs, Please Wait...', 'centered');		
}
function after_removesavedrfis() {
	s8_modal_center_show('Refreshing Page...');	
	window.location = '/account/managerfis';
}

function launchrfi_new() {
	$("savedlistingform").submit();
}


function launchrfi() {
	s8_simple_callbackform('/rfi/start', 'savedlistingform', 'after_launchrfi', 'Launching RFI, Please Wait...', 'centered');		
}
function backtolaunchrfi() {
	s8_simple_callbackform('/rfi/start', 'rfiform', 'after_launchrfi', 'Launching RFI, Please Wait...', 'centered');		
}

function after_launchrfi() {
	s8_modal_center_hide();
	$("searchbar").hide();
	$("fullbar").hide();
	$("fullbar2").show();	
}

function rfi_preview()
{
	s8_simple_callbackform('/rfi/preview', 'rfiform', 'after_rfi_preview', 'Previewing RFI, Please Wait...', 'centered');		
}

function after_rfi_preview() {
	s8_modal_center_hide();
	$("searchbar").hide();
	$("fullbar2").show();	
}
	
function rfi_send()
{

	s8_simple_callbackform('/rfi/send', 'rfiform', 'after_rfi_send', 'Sending RFI, Please Wait...', 'centered');		
}

function after_rfi_send() {
	s8_modal_center_hide();
	$("searchbar").hide();
	$("fullbar2").show();	
}

function closefullbar2() {
	s8_modal_center_hide();
	$("searchbar").show();
	$("fullbar2").hide();	
}
	


function removesavedarticles() {
	s8_simple_callbackform('/ajproc/removesavedarticles', 'savedarticleform', 'after_removesavedarticles', 'Removing Articles, Please Wait...', 'centered');		
}
function after_removesavedarticles() {
	s8_modal_center_show('Refreshing Page...');	
	window.location = '/account/managearticles';
}

function agenda_pop_login(subto) {
	url = '/ajproc/ajpoplogin/?subto='+subto;
	modal_centered = new Control.Modal(
		$('modal-centered-anchor'),
		{iframe: true,position: 'absolute',containerClassName: 'popcenter',overlayClassName: 'popcenter',width: 400, height: 200,iframeTemplate: new Template('<iframe src='+url+' width=\'100%\' height=\'100%\' frameborder=\'0\' id=\'#savepopup\'></iframe>')}
		);
	modal_centered.open();
	return false;
}


function agenda_save_article(rrid) {
	url = '/ajproc/savearticle?rrid='+rrid;
	modal_centered = new Control.Modal(
		$('modal-centered-anchor'),
		{iframe: true,position: 'absolute',containerClassName: 'popcenter',overlayClassName: 'popcenter',width: 400, height: 200,iframeTemplate: new Template('<iframe src='+url+' width=\'100%\' height=\'100%\' frameborder=\'0\' id=\'#savepopup\'></iframe>')}
		);
	modal_centered.open();
	return false;
}


function agenda_save_listing(rrid) {
	
	url = '/ajproc/savelisting?rrid='+rrid;
	modal_centered = new Control.Modal(
		$('modal-centered-anchor'),
		{iframe: true,position: 'absolute',containerClassName: 'popcenter',overlayClassName: 'popcenter',width: 400, height: 200,iframeTemplate: new Template('<iframe src='+url+' width=\'100%\' height=\'100%\' frameborder=\'0\' id=\'#savepopup\'></iframe>')}
		);
	modal_centered.open();
	return false;
}
function loadlisting(rrid) {
	// swap in fullsize prem/mq listing here
	s8_simple_callback('/ajproc/ajpopfull?sb='+currentsb+'&rrid='+rrid, 'after_loadlisting', 'Loading Content, Please Wait...', 'centered');
}
function loadlistingall(rrid) {
	// swap in fullsize prem/mq listing here
	s8_simple_callback('/ajproc/ajpopfull?sb='+currentsb+'&all=1&rrid='+rrid, 'after_loadlisting', 'Loading Content, Please Wait...', 'centered');
}

function after_loadlisting() {
	s8_modal_center_hide();
	$("searchbar").hide();
	$("fullbar").show();
	// show googlemap also
	jsdiv = $("googlejs");
	if(jsdiv) {
		jshtml = jsdiv.innerHTML;
		if(jshtml.length) {
			eval(jshtml);
		}	
	}
}

var ol_address1;
var ol_city;
var ol_province;
var ol_postalcode;

function dogmap() {
	showAddress(ol_address1+", "+ol_city+" "+ol_province+" "+ol_postalcode);
}

function showAddress(address) {
	
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("idgooglemap"));
		map.addControl(new GSmallMapControl());
		var geocoder = new GClientGeocoder();

		  geocoder.getLatLng(
		    address,
		    function(point) {
		      if (!point) {
		        //alert(address + " not found");
		     	$("idgooglemap").hide();
		        $("notonmap").show();
		      } else {
		        map.checkResize();
		        map.setCenter(point, 13);
		        var marker = new GMarker(point);
		        map.addOverlay(marker);
		        //marker.openInfoWindowHtml(address);
		      }
		    }
		  );
  
  	}
}



function ajshowAddress(address) {
	
	if (GBrowserIsCompatible()) {
											var map = new GMap2(document.getElementById("idgooglemap"));
											map.addControl(new GSmallMapControl());

											  var geocoder = new GClientGeocoder();
											  geocoder.getLatLng(
											    address,
											    function(point) {
											      if (!point) {
											        //alert(address + " not found");
											     	$("idgooglemap").hide();
											        $("notonmap").show();
											      } else {
											        map.setCenter(point, 13);
											        var marker = new GMarker(point);
											        map.addOverlay(marker);
											        //marker.openInfoWindowHtml(address);
											      }
											    }
											  );
	}
}											 


function submit_shortvenuesearch() {
	// submit search
	s8_simple_callbackform('/venues/ajvenuesearch?type=short&sb='+currentsb, 'shortvenuesearchform', 'after_submit_shortvenuesearch', 'Searching, Please Wait...', 'centered');
}
function after_submit_shortvenuesearch() {
	s8_modal_center_show('Found Results, Loading...');	
	window.location = '/venues/results/?sb='+currentsb;
}
function submit_longvenuesearch() {
	// submit search
	s8_simple_callbackform('/venues/ajvenuesearch?type=long&sb='+currentsb, 'longvenuesearchform', 'after_submit_longvenuesearch', 'Searching, Please Wait...', 'centered');
}
function after_submit_longvenuesearch() {
	
	s8_modal_center_show('Found Results, Loading...');	
	window.location = '/venues/results/?sb='+currentsb;
}

function submit_shortservicesearch() {
	// submit search
	s8_simple_callbackform('/services/ajservicesearch?type=short&sb='+currentsb, 'shortservicesearchform', 'after_submit_shortservicesearch', 'Searching, Please Wait...', 'centered');
}
function after_submit_shortservicesearch() {
	s8_modal_center_show('Found Results, Loading...');	
	window.location = '/services/results/?sb='+currentsb;
}
function submit_longservicesearch() {
	// submit search
	s8_simple_callbackform('/services/ajservicesearch?type=long&sb='+currentsb, 'longservicesearchform', 'after_submit_longservicesearch', 'Searching, Please Wait...', 'centered');
}
function after_submit_longservicesearch() {
	s8_modal_center_show('Found Results, Loading...');	
	window.location = '/services/results/?sb='+currentsb;
}


function popfull(rrid) {
	// pop/refresh the listing inside the space.
	params = 'rrid='+rrid;
	s8_simple_callbackparams('/ajproc/ajpopfull', params, 'popfullcomplete', 'Loading...', 'centered');		
}
function popfullcomplete(state) {
	
	s8_modal_center_hide();

	$("searchbar").hide();
	$("fullbar").show();

}

// when the regionid changes, reload the list of hoods.
function agenda_update_hood() {
	regionid = $("inf__resource_agvendor_regionid").getValue();
	params = 'regionid='+regionid;
	s8_token_param_callback('ajfillhoods', params, 'agenda_update_hood_complete');
}
function agenda_update_hood_complete(state) {
}

function setupmulti(htmlname) {
		
}


function agenda_onchange_findvenue_hood(thisobj) {
	thisobj = $('venue_regionid');
	regionid = thisobj.getValue();

	if(regionid == '') {
		$("rp-hoodvenue").hide();
		$("rp-statevenue").hide();
		return;
	}
	if(regionid == '250108') {
		$("rp-hoodvenue").hide();	
		$("rp-statevenue").show();	
		return;
	}
	$("rp-statevenue").hide();
	
	params = 'regionid='+regionid;
	s8_token_param_callback('ajfillhoodsvenue', params, 'agenda_onchange_findvenue_hood_complete');
}
function agenda_onchange_findvenue_hood_complete(state) {

	$("rp-hoodvenue").show();	

	s = $("rp-hoodvenue").innerHTML;
	s.evalScripts();
}

function agenda_onchange_findservice_hood(thisobj) {
	thisobj = $('service_regionid');

	regionid = thisobj.getValue();
	
	if(regionid == '') {
		$("rp-hoodservice").hide();
		$("rp-stateservice").hide();
		$("service_state").selectedIndex = 0;
		return;
	}
	if(regionid == '250108') {
		$("rp-hoodservice").hide();	
		$("rp-stateservice").show();	
		$("service_state").selectedIndex = 0;
		return;
	}
	$("rp-stateservice").hide();
	
	params = 'regionid='+regionid;
	s8_token_param_callback('ajfillhoodsservice', params, 'agenda_onchange_findservice_hood_complete');
}
function agenda_onchange_findservice_hood_complete(state) {

	$("rp-hoodservice").show();	

	s = $("rp-hoodservice").innerHTML;
	s.evalScripts();

}

var backto;
function agenda_delete(backtourl) {
	if(!confirm('Are you sure you want to delete this listing?')) {
		return false;	
	}
	backto = backtourl;
	s8_modal_wait_show('Deleting Item...');
	s8_token_callback('ajdelete','agenda_delete_complete');
	
	return false;
}
function agenda_delete_complete(state) {
	s8_modal_wait_show('Delete completed, returning to search');
	window.location = backto;
}

// when venue/service is changed
function agenda_change_service(iseventservice) {
			
	if(iseventservice==1) {
		$("venue-specific1").hide();
		$("event-specific1").show();
		$("venue-specific2").hide();
		$("event-specific2").show();
		//$("venue-specific3").hide();
		//$("event-specific3").show();
		$("venue-specific4").hide();
		$("event-specific4").show();
	}
	else {
		$("venue-specific1").show();
		$("event-specific1").hide();
		$("venue-specific2").show();
		$("event-specific2").hide();
		//$("venue-specific3").show();
		//$("event-specific3").hide();
		$("venue-specific4").show();
		$("event-specific4").hide();
	}
	
}


// choose a multisel item for the resource type and the resourceID.
// attach it to the profile, and reload the user-list with the lookups
function agenda_pick_mb(rtype, rrid) {
	
	// add this entry to the current form fields
	formvalue = $("inf__resource_agvendor_rtype"+rtype+"csv").getValue();
	formvalue = addtocsv(formvalue, rrid);
	f = $("inf__resource_agvendor_rtype"+rtype+"csv");
	f.value = formvalue;
	
	// reload the user-side with the lookup values for this resourcetype
	agenda_update_user_treesel(rtype);
}
/**
 * removes an item from the multi selection treelist.
 * removes the rrid from the csv hidden field, refreshes the display by calling back to the server for a name/id lookup
 * to display the data
 *
 */
function agenda_remove_mb(rtype, rrid) {
	// remove the item from the userdata
	formvalue = $("inf__resource_agvendor_rtype"+rtype+"csv").getValue();
	formvalue = removefromcsv(formvalue, rrid);
	f = $("inf__resource_agvendor_rtype"+rtype+"csv");
	f.value = formvalue;
	
	// reload the section of the page with the name.
	agenda_update_user_treesel(rtype);
}


/**
 * takes the current csv value for a multisel item, goes to the server to get the html snippet to update that part of the page.
 *
 */
function agenda_update_user_treesel(rtype) {

	// get the form value, and send it to the server
	formvalue = $("inf__resource_agvendor_rtype"+rtype+"csv").getValue();
	params = 'rtype='+rtype+'&csv='+escape(formvalue);
	s8_token_param_callback('ajusertreesel', params, 'agenda_update_user_treesel_complete');
}
function agenda_update_user_treesel_complete(state) {
}


// when the listing type is changed, certain things will happen.
function agenda_change_vendorlistingtype(listingtype) {
	if(listingtype==1) {
		$("inf__resource_agvendor_listingtype_1").checked = true;
		
		// premium	
		olist = $$(".for-premium-and-marquee", ".for-premium");
		for(var i=0; i<olist.length; i++){
			olist[i].show();	
		}
		olist = $$(".for-marquee", ".for-basic");
		for(var i=0; i<olist.length; i++){
			olist[i].hide();	
		}
	}
	else if(listingtype==2) {
		$("inf__resource_agvendor_listingtype_2").checked = true;
		// marquee
		olist = $$(".for-premium-and-marquee", ".for-marquee");
		for(var i=0; i<olist.length; i++){
			olist[i].show();	
		}
		olist = $$(".for-premium", ".for-basic");
		for(var i=0; i<olist.length; i++){
			olist[i].hide();	
		}
	}
	else {
		$("inf__resource_agvendor_listingtype_0").checked = true;
		// basic
		olist = $$(".for-premium-and-marquee", ".for-premium", ".for-marquee");
		for(var i=0; i<olist.length; i++){
			olist[i].hide();	
		}
		olist = $$(".for-basic");
		for(var i=0; i<olist.length; i++){
			olist[i].show();	
		}

	}
	
}
function agenda_change_listingtype() {
	
	listingtype = $("inf__resource_agvendor_listingtype").getValue();
	
	if(listingtype==1) {
		// premium	
		olist = $$(".for-premium-and-marquee", ".for-premium");
		for(var i=0; i<olist.length; i++){
			olist[i].show();	
		}
		olist = $$(".for-marquee", ".for-basic");
		for(var i=0; i<olist.length; i++){
			olist[i].hide();	
		}
	}
	else if(listingtype==2) {
		// marquee
		olist = $$(".for-premium-and-marquee", ".for-marquee");
		for(var i=0; i<olist.length; i++){
			olist[i].show();	
		}
		olist = $$(".for-premium", ".for-basic");
		for(var i=0; i<olist.length; i++){
			olist[i].hide();	
		}
	}
	else {
		// basic
		olist = $$(".for-premium-and-marquee", ".for-premium", ".for-marquee");
		for(var i=0; i<olist.length; i++){
			olist[i].hide();	
		}
		olist = $$(".for-basic");
		for(var i=0; i<olist.length; i++){
			olist[i].show();	
		}

	}
	
	//alert('f');
	//alert($$(".only-marquis"));

		
}

function check_limit(field, chars) {
	if (field.value.length > chars) field.value = field.value.substr(0, chars);
}

function agenda_photoupload_complete() {
	listingtype = 0;
	if($("inf__resource_agvendor_iseventservice_0").checked) listingtype = 0;
	if($("inf__resource_agvendor_iseventservice_1").checked) listingtype = 1;
	params = 'listingtype='+listingtype;
	s8_token_param_callback('ajrefreshphoto', params, 'agenda_photoupload_complete_done');
}
function agenda_photoupload_complete_done(state) {
	//alert('doneloading');
	//alert(modalwindowcentered);
	modal_centered.close();

}

function agenda_pdfupload_complete() {
	//listingtype = 0;
	//if($("inf__resource_agvendor_listingtype_0").checked) listingtype = 0;
	//if($("inf__resource_agvendor_listingtype_1").checked) listingtype = 1;
	//if($("inf__resource_agvendor_listingtype_2").checked) listingtype = 2;
	//params = 'listingtype='+listingtype;
	params = 'aaaa=222';
	s8_token_param_callback('ajrefreshpdf', params, 'agenda_pdfupload_complete_done');
}
function agenda_pdfupload_complete_done(state) {
	modal_centered.close();
}




// add and remove a value to and from a csv formatted list.
	function removefromcsv(formvalue, toremove) {
		// remove an item from the selections
		newcsv = new Array;
		if(formvalue.length>0) {
			ar = formvalue.split(',');
			ar.each(function(item) {
				if(item!=toremove) {
					newcsv.push(item);
				}
			});
			formvalue = newcsv.join(',');
		}
		return formvalue;
	}
	function addtocsv(formvalue, rrid) {
		newcsv = new Array;
		if(formvalue.length>0) {
			ar = formvalue.split(',');
			if(ar.any(function(item) {
				if(item.toString()==rrid.toString()) {
					return true;	// already in the list.
				}
				return false;
			})) return formvalue;
			ar.push(rrid);
			formvalue = ar.join(',');
		}
		else {
			formvalue = rrid.toString();
		}
		return formvalue;
	}

function gosort(colname) {
	// reset the sort back to the col name specified.
	s8_modal_wait_show('Re-sorting results...');

	params = 'colname='+colname;
	s8_token_param_callback('ajresort', params, 'gosort_complete');
}
/**
 * callback for gosort
 *
 */
function gosort_complete(state) {
	// process results and display. requestbucket.a.json
	// done, just redirect
	s8_modal_wait_hide();
	
	// OR just reshow the results.
	// TODO hardcode and start with pg.
	//window.location = '/admin/listing/choose';	
}


function copydownaccount() {
	// copy down account holder info on checked = yes.
	
	if(!($("inf__resource_agvendor_btsame").checked)) return;
	
	
	
	$("inf__resource_agvendor_btfirstname").value = $("inf__account_contact_firstname").value;
	$("inf__resource_agvendor_btlastname").value = $("inf__account_contact_lastname").value;
	$("inf__resource_agvendor_bttitle").value = $("inf__account_contact_title").value;
	$("inf__resource_agvendor_btcompany").value = $("inf__account_contact_company").value;
	$("inf__resource_agvendor_btaddress1").value = $("inf__account_contact_address1").value;
	$("inf__resource_agvendor_btaddress2").value = $("inf__account_contact_address2").value;
	$("inf__resource_agvendor_btcity").value = $("inf__account_contact_city").value;
	$("inf__resource_agvendor_btprovince").value = $("inf__account_contact_province").value;
	$("inf__resource_agvendor_btpostalcode").value = $("inf__account_contact_postalcode").value;
	$("inf__resource_agvendor_btphone").value = $("inf__account_contact_phone").value;
	$("inf__resource_agvendor_btfax").value = $("inf__account_contact_fax").value;
	//$("inf__resource_agvendor_btmobile").value = $("inf__account_contact_mobile").value;
	$("inf__resource_agvendor_btemail").value = $("inf__account_contact_email").value;
	$("inf__resource_agvendor_btwebsite").value = $("inf__account_contact_website").value;
	
	
}


// Logic to execute when the end user    
// clicks the element   
function googletracklink(e) {   
  var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
	
	href = targ.href;
	
	// do not pass # links out (ajax internals)
	if(href) {
		var lastch=href.charAt(href.length-1);
		if(lastch != '#') {
	  		urchinTracker(href.toString());
		}
	}
}   
  
// Register the onclick event for all elements    
// the given class name   
function assigngoogle() {
  	// assign all a elements onclick with it.
	var someNodeList = document.getElementsByTagName('a');
	var nodes = $A(someNodeList);
  	nodes.each(   
    function(e) {   
      // Assign the onclick method to the element   
      Event.observe(e, "click", googletracklink);   
    }   
  );   
}   


function fixie2(oo) {  
    if(document.all && !window.opera) {  
        var content = oo.div.innerHTML;  
        oo.div.innerHTML = '<iframe frameborder="0" style="position:absolute; left:0; top:0; width:100%; height:100%; margin:0; padding:0; background:transparent; filter:alpha(opacity=0);"></iframe>';  
 
        oo.iframe = oo.div.firstChild;  
 
        child = document.createElement('DIV');  
        oo.div.appendChild(child);  
        child.style.position = 'absolute';  
        child.style.left = '0px';  
        child.style.top = '0px';  
        child.style.width = '100%';  
        child.style.height = '100%';  
        child.innerHTML = content;  
 
        child.className = oo.div.className;  
        oo.div.className = '';  
 
        return child;  
 
    }  
    else {  
        return oo.div;  
    }  
}  
function fixie3(oo) {  
    if(document.all && !window.opera) {  
        var content = oo.innerHTML;  
        oo.innerHTML = '<iframe frameborder="0" style="position:absolute; left:0; top:0; width:100%; height:100%; margin:0; padding:0; background:transparent; filter:alpha(opacity=0);"></iframe>';  
 
        oo.iframe = oo.firstChild;  
 
        child = document.createElement('DIV');  
        oo.appendChild(child);  
        child.style.position = 'absolute';  
        child.style.left = '0px';  
        child.style.top = '0px';  
        child.style.width = '100%';  
        child.style.height = '100%';  
        child.innerHTML = content;  
 
        child.className = oo.className;  
        oo.className = '';  
 
        return child;  
 
    }  
    else {  
        return oo.div;  
    }  
}  


var shimURL_http = 'about:blank';
var shimURL_https = '/Custom_Components/HTML/blank.html';
var shimURL = (window.location.href.toLowerCase().indexOf('https://') == 0 ? shimURL_https : shimURL_http );
function underlayShim(elObj) {
//alert(’underlayShim(’ dumpthis(elObj) ’)’);
try {
	// get top layer
	layerTop = $(elObj);
	// get shim layer
	if (!$(layerTop.id+'Shim')) {
		document.body.insertAdjacentHTML("beforeEnd",'');
	}
	layerShim = $(layerTop.id+'Shim');
	// set attribute for future shim needs
	layerTop.shimID = layerTop.id+'Shim';
}
catch(e) { }

}


function ieshow(element,iframe) { 
  iframe = iframe || false; 
  if (iframe) {  ieoverlap(element); } 
  $(element).style.display = ''; 
  return element; 

}; 

function iehide(element) { 
    $(element).style.display = 'none'; 
    if ($(element + "_iefix")) { 
      Element.remove($(element + "_iefix")); } 
    return element; 

}; 

function ieoverlap(element) { 
  alert('t');
  var id = $(element).id; 
  new Insertion.After(id, '<iframe id="' + id + '_iefix" '+ 'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' + 'src="javascript:false;" frameborder="0" scrolling="no"></iframe>'); 
  //setTimeout(fixIEOverlapping, 1); 
fixIEOverlapping();
  function fixIEOverlapping() { 
    var norm = $(element); 
    var iefix = $(norm.id + "_iefix"); 
    Position.clone(norm, iefix); 
    iefix.style.zIndex = (norm.style.zIndex - 1); 
    ieshow(iefix);
  } 
};

function ffff(e) {
	
	e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
}

function getScrollerWidth() {
  var scr = null;
  var inn = null;
  var wNoScroll = 0;
  var wScroll = 0;
 
  // Outer scrolling div
  scr = document.createElement('div');
  scr.style.position = 'absolute';
  scr.style.top = '-1000px';
  scr.style.left = '-1000px';
  scr.style.width = '100px';
  scr.style.height = '50px';
  // Start with no scrollbar
  scr.style.overflow = 'hidden';
 
  // Inner content div
  inn = document.createElement('div');
  inn.style.width = '100%';
  inn.style.height = '200px';
 
  // Put the inner div in the scrolling div
  scr.appendChild(inn);
  // Append the scrolling div to the doc
 
  document.body.appendChild(scr);
 
  // Width of the inner div sans scrollbar
  wNoScroll = inn.offsetWidth;
  // Add the scrollbar
  scr.style.overflow = 'auto';
  // Width of the inner div width scrollbar
  wScroll = inn.offsetWidth;
 
  // Remove the scrolling div from the doc
  document.body.removeChild(
  document.body.lastChild);
 
  // Pixel width of the scroller
  return (wNoScroll - wScroll);
}

