
/*
FILE CONCAT ADD FILE
PATH: /ft/resources/client/modules/glossary/AddEditTermNews.js
*/
var AddEditTermNews_class = function(oNews) {
	this.relatedNews = oNews || {};
}

AddEditTermNews_class.prototype.URL_VALIDATE_NEWS = "/ft/resources/buffer/glossaryValidateNewsArticle.asp";

AddEditTermNews_class.prototype.init = function(){
	this.elRelatedNewsContainer = Element.get("adminRelatedNews");
	this.elInput = Element.get("searchFieldNews");
	this.elButton = Element.parseSelector("div.basicButton div", "adminRelatedNewsAdd", "first");
	
	Events.add(this.elRelatedNewsContainer, "click", this.removeNews, this);
	Events.add(this.elButton, "click", this.submitNewsArticle, this);
}

AddEditTermNews_class.prototype.submitNewsArticle = function(e, el) {
	e.cancel();

	this.cb = this.cb || new ContentBuffer();
	this.cb.abortRequests()
	
	this.cb.load({
		url: this.URL_VALIDATE_NEWS,
		contentType: "text/javascript",
		data: {
			newsURL: this.elInput.value
		},
		context: this,
		preventEval : true,
		onload: this.handleResults,
		onerror: this.showError
	});
};

AddEditTermNews_class.prototype.handleResults = function(cb) {
	var result = this.getSerializer().deserialize(cb.getResult());
	
	if (result.url) {
		var container = Element.get("adminRelatedNews") 
		
		Element.create("div", {"class":"addedRelatedNews relatedNewsHolder", "docKey":result.docKey},[
			Element.create("a", {"href":result.url, "docKey":result.docKey, "target":"_blank", "style":"float:left;"}, result.headline),
			Element.create("div", {"style":"float:right", "class":"icon icon-delete-close"})
		], container);
		Element.create("div", {"style":"clear:both"}, null, container);
		
		this.relatedNews.push(result.docKey);
		
		this.elInput.value = "";
		this.elInput.focus();
		
		return;
	}
	
	alert("The requested story could not be found, please try again.");
}

AddEditTermNews_class.prototype.removeNews = function(e, el){
	var target = e.getTarget();

	if(Element.hasClass(target, "icon-delete-close")){
		var parentDiv = Element.getParentBySelector(target, "div.relatedNewsHolder")
		
		var updatedRelatedNews = [],
			docKey = parentDiv.getAttribute("docKey");
			
		for (var i = 0; i < this.relatedNews.length; i++) {
			if (docKey == this.relatedNews[i]) {
				this.relatedNews[i] = null;
			}
		}
		
		Element.remove(parentDiv)
	}
}

AddEditTermNews_class.prototype.getSerializer = function() {
	var s = new Serializer();
	
	this.getSerializer = function() {
		return s;
	}
	
	return this.getSerializer();
}
/*
FILE CONCAT ADD FILE
PATH: /ft/resources/style/alerts.css.asp
*/


#wsod .prefSection {
    float: left;
    margin-bottom: 0;
    padding-bottom: 15px;
    border-bottom: 1px solid #E7E2DB;
    width: 100%;
    position: relative;
}

#wsod .prefSection p {
    font-size: 12px;
}

#wsod .prefDescr {
    float: left;
    width: 270px;
    clear: left;
}

#wsod .prefDescr p {
    float: left;
    clear: left;
    font: normal 11px arial;
    color: #666666;
    margin-right: 20px;
	width: 92%;
}

#wsod .prefDescr p.vacationStop {
    margin-right: 0;
}

#wsod .prefDescr p.vacationStop input,
#wsod .prefDescr p.vacationStop label {
    vertical-align: middle;
   
}
#wsod .prefDescr p.vacationStop label {
		margin: 0;
 }
#wsod .prefDescr h3 {
    border-bottom: none;
    text-transform: none;
    font: normal 14px arial;
    float: left;
    clear: left;
    margin-top: 10px;
    margin-bottom: 0px;
}

#wsod .prefControls {
    position: relative;
    float: left;
    width: 320px;
	font-size: 11px;
	color: #666;
}

#wsod .prefControls fieldset {
    width: 100%;
}

#wsod .portfolioAlertVagueries {
    float: left;
    width: 55%;
}

#wsod .portfolioAlertSpecificsFrame {
    padding: 5px;
    float: right;
    width: 223px;
    position: relative;
}

#wsod .portfolioAlertSpecifics ul {
    /*list-style: square inside url('/ft/resources/image/bullet.png');*/
    /*list-style: disc inside;*/
    list-style: auto;
    color: #666666;
    padding-left: auto;
}

#wsod .portfolioAlertSpecifics li {
    font-size: 12px;
    font-weight: bold;
    font-color: 
}

#wsod.Alerts form fieldset {
    float: left;
    clear: none;
    margin-top: 10px;
}

#wsod.Alerts form fieldset.formatPrefs label {
    padding: 0px 5px;
}

#wsod.Alerts form label {
    color: #666666;
    font: normal 11px arial;
    white-space: nowrap;
}

#wsod .emailAddress {
    float: left;
    clear: both;
    border: 1px solid #cccccc;
}

#wsod .messageType {
    vertical-align: middle;
    margin-left: 0px;
    margin-top: 0px;
}

#wsod .exampleLink {
    font-size: 11px;
    margin-left: 10px;
}

#wsod.Alerts .prefControls fieldset.formatPrefs .exampleLink {
    font-size: 11px;
    margin-left: 0px;
	margin-right:10px;
}

#wsod .dateSelect {
    float: left;
    font: normal 11px arial;
    color: #666666;
    width: 100%;
}
#wsod .dateSelect #start, #wsod .dateSelect div {
    float: left;
    width:160px;
    border:0px solid black;
}

#wsod .dateSelect label {
display:block;
    
}

#wsod .dateSelect select {
    font: bold 11px arial;
    border: 1px solid #cccccc;
    margin-right: 2px;
    
}

#wsod .errorPopup .popupInner {
	width: 300px;
}
#wsod .errorPopup .popupFooter {
	clear: both;
	padding: 5px 0;
}
#wsod .errorPopup .basicButton {
	float: right;
}


#wsod .equityControls {
    border-top: 1px solid #E7DFD0;
    border-bottom: 1px solid #E7DFD0;
    background-color: #F6E9D8;
    float: left;
    clear: both;
    width: 100%;
    padding-bottom: 5px;
}

#wsod .equityControls label {
    margin: 8px 5px;
    padding: 0;
    color: #888888;
    font-size: 11px;
    float: left;
}

#wsod .equityControls input {
    font: bold 11px arial;
    width: 13em;
    margin: 5px;
    padding: 3px;
    border: 1px solid #D3D3D3;
    float: left;
}

#wsod .equityControls .basicButton {
    margin: 5px;
}

#wsod .submitButtonSection .basicButton {
	float: right;
	margin: 5px 0;
}

/* #wsod .submitButtonSection {
    position: relative;
    top: 5px;
    clear: both;
    height:1px;
}

#wsod .submitButtonSection .basicButton {
    position: absolute;
    right: 0px; top: 0px;
} */

#wsod table.equityAlerts {
    clear: both;
}

#wsod .equityAlerts th {
    text-align: left;
    padding: 5px 0px;
}


#wsod .portfolioAlertFrame .popupInner fieldset {
    width: 49%;
    float: left;
    border-bottom: none;
}

#wsod .portfolioAlertFrame .popupInner fieldset.submitSet {
    width: 100%;
    border-top: 1px solid #E7E2DB;
}


#wsod .formSubmit {
    float: right;
    margin-top: 5px;
    clear: both;
}

#wsod .equityAlerts td {
    text-align: left;
    padding-left: 0;
    font: normal 14px arial;
    color: #666666;
    vertical-align: top;
}

#wsod .equityAlerts td.actionCell {
    vertical-align: middle;
}

#wsod .equityAlerts td.symbol .issue {
    color: #003399;
}

#wsod .equityAlerts td.symbol .companyName {
    display: block;
    font-size: 11px;
}

#wsod .equityAlerts td .action {
    float: left;
    display: block;
}

#wsod .equityAlerts tfoot td {
    font-size: 11px;
}

#equityAlertsDetails {
    margin-top: 5px !important;
}

#wsod .alertDisclaimer {
    position: absolute;
    right: 0px;
    color: #666666;
    font-size: 11px;
    font-family: arial;
}
