function getInvocationCode(partner)
{
	   var type = jQuery("input[name='zse-widget-type'][@checked]").val();
	   if (type=='undefined' || !type)
		{
			type='event';
		}
		var data;
		data = "color="+jQuery("#hid_color").val()+
		       "&height="+jQuery("#zse-widget-height").val()+
		       "&width="+jQuery("#zse-widget-width").val()+
		       "&type="+type+
		       "&title="+jQuery("#zse-widget-title").val();
		       
		       jQuery.ajax({
                  url: '/' + venueIdentifier + '/widgets/view/0',
                  type:"post",
                  data: data,
                  success: function(result)
                          {
                      	    jQuery("#zse-widget_container").html('');
                            jQuery("#zse-widget_container").html(result);
                          }
                   });
                   
		jQuery.getJSON(
					'/widgets/invocationcode/',
					data,
					function (res)
						{
							jQuery("#invocation_code").show("normal");
							jQuery("#zse-widget-code").val(res);
							jQuery("#confirm").show();
							jQuery("#invocation_code_confirm").hide();
						}
			);
	  
}


function zs_wt_init(serverRoot)
{
	wt_js = document.createElement("script");
	wt_js.type = "text/javascript";
    var widgetParams = '';
    var urlString    = '';
    
    if (wParam)
    {
        widgetParams = eval(wParam);
    }
    
    for (param in widgetParams)
    {
        urlString += param + "=" + widgetParams[param] + "&";
    }

    urlStringLen = urlString.length - 1;
    urlString    = urlString.substring(0, urlStringLen);

    wt_js.src = serverRoot + "/widgets/widgetDisplay?"+ urlString;
    
	document.getElementsByTagName("head")[0].appendChild(wt_js);
	
	jQuery("#zs_webtools").html("Loading....");
}

function zs_wt_Hover(model)
{
	jQuery("#" + model + " li").click(function()
		{
			this.addClass("zse-selected");
		}
	);
}

function zs_wt_commonUsabilities()
{
	jQuery(":text").css("color","#666666").click(
						function ()
						{
							tp = jQuery(this).val();
									
							if (tp.indexOf("eg: ") > -1)
							{
								jQuery(this).val("");
							}
				});
				
	jQuery("#zse-leadin-b-icons img").mouseover( function ()
			{
				clearInterval(zs_wt_animate);
			}
	);
	jQuery("#zse-leadin-b-icons img").mouseout( function ()
			{
				zs_wt_animate = setTimeout("zs_wt_animateImage()", zs_wt_transition_timeline);
			}
	); 
}	

function zs_wt_validate(wt_form)
{
	jQuery("#"+wt_form+" :text").each( function ()
			{
				tp = jQuery(this).val();
		
				if (tp.indexOf("eg: ") > -1)
				{
					tp = tp.replace("eg: ", "");
					jQuery(this).val(tp);			
				}
			}
	);
	
	zs_wt_email = jQuery("#zse-leadin-a-email #email").val();
	
	return true;	
}
