
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function confirmDeleteCruise(URL){
	if (location.replace == null){
		location.replace = location.assign
	}
	if(confirm("You are about to delete this cruise offer.  Do you want to proceed?")){
		location.replace(URL);
	}
}


function makeSocialMediaWindow(form_url,heightArg,widthArg) {

   try {

   	ColdFusion.Window.destroy('sm_promote',true);

   } catch(e) { }

	 heightArg = typeof(heightArg) != 'undefined' ? heightArg : 425;
	 widthArg = typeof(widthArg) != 'undefined' ? widthArg : 500;
   ColdFusion.Window.create('sm_promote','Promote Offer',form_url,{x:25,y:25,height:heightArg,width:widthArg,modal:true,closable:true,draggable:true,resizable:true,center:true });

	ColdFusion.Window.onHide('sm_promote',cleanupSocialMediaWindow);
	
	
}



function cleanupSocialMediaWindow() {

   ColdFusion.Window.destroy('sm_promote',true);

}


function copyToClipboardInit( button_element,button_container ){

	if (navigator.appName != 'Microsoft Internet Explorer') {
		ZeroClipboard.setMoviePath('http://web1.signaturetravelnetwork.com:8602/scripts/ZeroClipboard.swf');
		clip = new ZeroClipboard.Client();
		clip.addEventListener( 'load', function(client) { 
                                clip.setText( document.getElementById('short_url_text').value );
                        } );	
		clip.addEventListener( 'mouseDown', function(client) { 
								alert('The link has been copied to your clipboard');
                                clip.setText( document.getElementById('short_url_text').value );
                        } );

		clip.glue(button_element, button_container);
		//document.getElementById('d_clip_container').addEventListener('mouseover', copyToClipboardMouseOver,true);
	}
}

function copyToClipboardMouseOver(client) {
	alert(document.getElementById('short_url_text').value);
	clip.setText( document.getElementById('short_url_text').value );
	alert('test2');
	}
		
function copyToClipboard(field_value,button_element,button_container){

	if(navigator.appName == 'Microsoft Internet Explorer'){
		alert('The link has been copied to your clipboard');
		window.clipboardData.setData('text',field_value);
	/*} else {
			ZeroClipboard.setMoviePath('http://web1.signaturetravelnetwork.com:8602/scripts/ZeroClipboard.swf');
			clip = new ZeroClipboard.Client();
			alert(field_value);
			clip.addEventListener( 'load', function(client) { 
	                                clip.setText( document.getElementById('short_url_text').value );
	                        } );	
			clip.addEventListener( 'mouseover', function(client) { 
									alert('The link has been copied to your clipboard');
	                                clip.setText( document.getElementById('short_url_text').value );
	                        } );	
			clip.glue(button_element, button_container);		*/	

	}
}

		
		
		

function sendTwitterURL(agentSettingRadio,urlString,agencyid,userid,title,desc,img){
	var agentSetting = 0;
	for( i = 0; i < agentSettingRadio.length; i++ )
	{
		if( agentSettingRadio[i].checked == true )
			agentSetting = agentSettingRadio[i].value;
	}
	var utilObj = new utilsObj();
	var clean_url = utilObj.cleanseURLRemote(JSON.stringify(urlString),agentSetting);
	var short_url = utilObj.shortenURLRemote(JSON.stringify(clean_url),agencyid,userid,'6',JSON.stringify(title),JSON.stringify(desc),JSON.stringify(img),'2',agentSetting);
	window.open ( "http://twitter.com/share?text=" + title + "&url=" + short_url,"tweet","location=1,status=1,scrollbars=1,width=550,height=400");
	ColdFusion.Window.destroy('sm_promote',true);
}
		
		

