﻿
function popRegister(fx_params, fx_submit) {    
    var var_postdata = '';
    var var_modal = '';
    var fx_form = 'frmpopreg';
    tb_show('Register to Win!','#TB_inline?height=480&width=650&inlineId=tbapploading')
    if (fx_params=='') {
        fx_params = 'p=s'
    }     
    if (fx_submit==true) {
        if (document.getElementById(fx_form)!=null) {
            var_postdata = formData2QueryString(document.getElementById(fx_form))
        }            
    }
    ajaxgetdata('/site/web/pop/register/app.cnx?p=s&' + fx_params, var_postdata, 'TB_ajaxContent','TB_ajaxContent', 1);
}

function popRegSendBookChange() {
    if ($('#popRegFldSendBook').val().toString()=='0') {
        $('#popRegFldSendBook').val('1');
        $('.popRegFreeBook').addClass('popRegChecked');
    } else {
        $('#popRegFldSendBook').val('0');
        $('.popRegFreeBook').removeClass('popRegChecked');    
    }
}


function popRegCatToggle(fx_cat) {
    if ($('#popRegCat_'+fx_cat).hasClass('popRegChecked')) {
        $('#popRegCat_0').removeClass('popRegChecked');
        $('#popRegCat_'+fx_cat).removeClass('popRegChecked');
        $('#popRegSelectedCats').val($('#popRegSelectedCats').val().replace('[' + fx_cat + ']',''));
        if (fx_cat=='0') {
            $('#popRegSelectedCats').val('');
            $('.sc_cat').removeClass('popRegChecked');    
        }
    } else {  
        $('#popRegCat_'+fx_cat).addClass('popRegChecked');        
        $('#popRegSelectedCats').val($('#popRegSelectedCats').val() + '[' + fx_cat + ']');
        if (fx_cat=='0') {
            $('#popRegSelectedCats').val('');
            $('.sc_cat:not(#popRegCat_0)').removeClass('popRegChecked');
            $('.sc_cat:not(#popRegCat_0)').click();    
        }
    }
}



// JScript File



function winshowAddress() {
  geocoder.getLatLng(
    wincuraddress,
    function(point) {
      if (!point) {
        //alert(wincuraddress + " not found");
      } else {
        map = new GMap2(document.getElementById("winListingmap"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());        
        map.setCenter(point, 13);
        var marker = new GMarker(point);
        map.addOverlay(marker);
        //marker.openInfoWindowHtml(wincuraddress);
      }
    }
  );
}    



var varDirCurrentListing = 0;
var varDirCurrentVideo = '';

function winMediaTabsChange(fx_changeup) {

    changeClass('winListingmapinfocont', 'winListingmapinfocont')
    changeClass('winListingVideoCont', 'winListingmapinfocont')

        
    changeClass('winMedTabPhotos', 'winListingMediaButton')
    changeClass('winMedTabVideo', 'winListingMediaButton')
    changeClass('winMedTabFlashVideo', 'winListingMediaButton')
    changeClass('winMedTabLocation', 'winListingMediaButton')
    
    
    document.getElementById('winListingVideoHere').innerHTML='';
    
    changeClass(fx_changeup, 'winListingMediaButton winMedShowHi')

    if (document.getElementById(fx_changeup)) {
        document.getElementById(fx_changeup).blur();
    }        
    
    if (fx_changeup=='winMedTabPhotos') {
        winMedPlaySlideShow(varDirCurrentListing);
    }
    
    if (fx_changeup=='winMedTabVideo') {
    
        document.getElementById('winListingMediaAreaInside').innerHTML='';
        document.getElementById('winListingMediaAreaInside').style.backgroundColor = '#000000';
        changeClass('winListingVideoCont', 'winListingmapinfocontShow')
        winMedPlayVideo(varDirCurrentVideo);

		cnxAct('listing-video',varDirCurrentListing);
    }
    
    if (fx_changeup=='winMedTabFlashVideo') {
    
        document.getElementById('winListingMediaAreaInside').innerHTML='<div id=\'vinListingFlashVideoCont\' style=\'width: 570px; height: 300px; overflow: hidden; \'><div id=\'winListingShowFlashVideoHere\' style=\'color: #FFFFFF;\'>Please Install the most recent version of Adobe Flash Player.</div></div>';
        document.getElementById('winListingMediaAreaInside').style.backgroundColor = '#000000';
        
        changeClass('winListingVideoCont', 'winListingmapinfocontShow')
        callFlashVideo(varDirCurrentVideo)
			
		cnxAct('listing-video',varDirCurrentListing);
        
    }
    
    
        
    if (fx_changeup=='winMedTabLocation') {
    
        document.getElementById('winListingMediaAreaInside').innerHTML='';
        document.getElementById('winListingMediaAreaInside').style.backgroundColor = '#BBBBBB';
    
        changeClass('winListingmapinfocont', 'winListingmapinfocontShow')
        
        winshowAddress()
			
		cnxAct('listing-map',varDirCurrentListing);
        
        
    
    }
    
    if (fx_changeup=='winMedTabBrochure') {
    
        document.getElementById('winListingMediaAreaInside').style.backgroundColor = '#FFFFFF';
        ajaxgetdata('/site/web/directory/listing/ajax_brochure.cnx?show=full', '', 'winListingMediaAreaInside','winListingMediaAreaInside', 1)
    
    
    }
        
    

    
    
}

function callFlashVideo(fx_movie) {
    var so = new SWFObject("/site/web/directory/fx/player2.swf", "winListingShowFlashVideoHere", "570", "300", "7", "#000000");
    so.addVariable("vcpvs", fx_movie);
    so.addParam('allowFullScreen', 'true');	
    so.addParam('allowScriptAccess', 'sameDomain');	
    so.addParam('scale', 'showall');			
    so.addParam('wmode', 'transparent');			
    so.write("winListingShowFlashVideoHere");
}



function winListingReqBrochShow() {

    ajaxgetdata('/site/web/directory/listing/ajax_brochure.cnx?show=full&listing=' + varDirCurrentListing, '', 'winListingReqFormBox','winListingReqFormBox', 1)



}


function winListingReqSubmit(fx_form) {
    var var_postdata = formData2QueryString(fx_form);
    ajaxgetdata('/site/web/directory/listing/ajax_brochure.cnx?listing=' + varDirCurrentListing + '&form=sub', var_postdata, 'winListingReqFormBox','winListingReqFormBox', 1)
}


function winLoadFeatures() {

    var so = new SWFObject('/ctl/graphics/slideshow.swf', 'SOmonoSlideshow', '273', '143', '7', '#FFFFFF');
    so.addVariable('imageScaleMode', 'scaleToFit');		
    so.addVariable('showLogo', 'false');
    so.addVariable('showVersionInfo', 'false');	
    so.addVariable('preloadImages', '2');	
    so.addVariable('showControls', 'false');					
    so.addVariable('backgroundColor', '000000');					
    so.addVariable('imageTransitionTime', '1');					
    so.addVariable('imagePause', '3');		
    so.addParam('wmode', 'opaque');				
    so.addVariable('dataFile', '/site/content/home/slideshowconfig.asp?cnxajaxcall=true&rnd='+ Math.random().toString());
    so.write('winHomeFeaturedSS');

}


function xpsSocialBMTP(fx_network) {
	if (fx_network=='twitter') {
		window.location='http://twitter.com/home?status=' + encodeURIComponent(document.location.href);
	}
	if (fx_network=='technorati') {
		window.location='http://technorati.com/faves?add=' + encodeURIComponent(document.location.href);
	}
	if (fx_network=='stumbleupon') {
		window.location='http://www.stumbleupon.com/submit?url=' + encodeURIComponent(document.location.href);
	}
	if (fx_network=='reddit') {
		window.location='http://reddit.com/submit?url=' + encodeURIComponent(document.location.href);
	}
	if (fx_network=='linkedin') {
		window.location='http://www.linkedin.com/shareArticle?mini=true&url=&source=' + encodeURIComponent(document.location.href);
	}
	if (fx_network=='kirtsy') {
		window.location='http://www.kirtsy.com/submit.php?url=' + encodeURIComponent(document.location.href);
	}
	if (fx_network=='google') {
		window.location='http://www.google.com/bookmarks/mark?op=edit&bkmk=' + encodeURIComponent(document.location.href);
	}
	if (fx_network=='facebook') {
		window.location='http://www.facebook.com/share.php?u=' + encodeURIComponent(document.location.href);
	}
	if (fx_network=='mailto') {
		window.location='mailto:?subject=Check out what I found!&body=' + encodeURIComponent(document.location.href);
	}
	if (fx_network=='digg') {
		window.location='http://digg.com/submit?phase=2&url=' + encodeURIComponent(document.location.href);
	}
	if (fx_network=='delicious') {
		window.location='http://del.icio.us/post?url=' + encodeURIComponent(document.location.href);
	}
}