/*************************************************************************

 

                        Miscellaneous functions

 

*************************************************************************/

 

function openwidgetcode(bannerId,bannerUrl,width,height)
{

            w = width  + 60;
            h = height + 60; 

            LeftPosition = (screen.width)  ? (screen.width-w)  / 2 : 200;
            TopPosition  = (screen.height) ? (screen.height-h) / 2 : 150;
            settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',resizable';
            wName = '/widget?id='+bannerId+'&bannerUrl='+bannerUrl+'&width='+width+'&height='+height;
            window.open(wName, '_blank', settings);

}
function openVideoEmbed(url,width,height)
{
	        w = width  + 60;
            h = height + 60; 

            LeftPosition = (screen.width)  ? (screen.width-w)  / 2 : 200;
            TopPosition  = (screen.height) ? (screen.height-h) / 2 : 150;
            settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',resizable';
            wName = url+'?&width='+width+'&height='+height;
            window.open(wName, '_blank', settings);
}
function filterTours(formName,filter) 
{
	document.forms[formName].filterType.value = filter;
	document.forms[formName].submit();
}
function logoGlow()
{
	document.getElementById("headerTop").style.backgroundPosition = '0 -160px';
}
function removeLogoGlow()
{
	document.getElementById("headerTop").style.backgroundPosition = '0 0';
}
function populateInviteData(iTitle,iLocation,iDate,iArtist)
{	
	var tourTitle 	= replaceAll(iTitle,"^","'");	
	var tourLoc 	= replaceAll(iLocation,"^","'");
	//all the possible fields in this json object
	json = {
	
	widget_version:"2.0",
	widget_skin:"button_square_small",
	partner_id:"142",
	title:tourTitle,
	location:tourLoc,
	date:iDate,
	artist:iArtist
	}

	//replace any current invite data using the json object
		inviteButtons[0].setOptions(json);

	//refresh the html to reflect new data
		inviteButtons[0].refresh();
   // launch the invite
   loadInviteInModal(0);
}
function replaceAll(Source,stringToFind,stringToReplace){
  var temp = Source;
    var index = temp.indexOf(stringToFind);
        while(index != -1){
            temp = temp.replace(stringToFind,stringToReplace);
            index = temp.indexOf(stringToFind);
        }
        return temp;
}

