/*
 * downloadModal.js
 */
function openDownloadModalVideo(url1,url2,successMsgVideo,artistSongVideo,saveMsgVideo,buttonTxt,pixMsgVideo1,pixMsgVideo2,suggestMsgVideo1,suggestMsgVideo2,widgetType,y) {
	initDownloadModal();
	
	var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;
	
	if (!ie7) {
		downloadModalLock();
		fadeWindow('downloadModalLock','in',0,20);
	}
	
	var _downloadLinkVideo1 = document.getElementById('downloadLinkVideo1'+widgetType);
	_downloadLinkVideo1.setAttribute('href', unescape(url1));
	_downloadLinkVideo1.innerHTML = buttonTxt;
	
	var _downloadLinkVideo2 = document.getElementById('downloadLinkVideo2'+widgetType);
	_downloadLinkVideo2.setAttribute('href', unescape(url2));
	_downloadLinkVideo2.innerHTML = buttonTxt;
	
	var _successMsgVideo = document.getElementById('successMsgVideo'+widgetType);
	_successMsgVideo.innerHTML = successMsgVideo;
	
	var _artistSongVideo = document.getElementById('artistSongVideo'+widgetType);
	_artistSongVideo.innerHTML = decodeURI(artistSongVideo);
	
	var _pixMsgVideo1 = document.getElementById('pixMsgVideo1'+widgetType);
	_pixMsgVideo1.innerHTML = pixMsgVideo1;
	
	var _pixMsgVideo2 = document.getElementById('pixMsgVideo2'+widgetType);
	_pixMsgVideo2.innerHTML = pixMsgVideo2;
	
	var _suggestMsgVideo1 = document.getElementById('suggestMsgVideo1'+widgetType);
	_suggestMsgVideo1.innerHTML = suggestMsgVideo1;
	
	var _suggestMsgVideo2 = document.getElementById('suggestMsgVideo2'+widgetType);
	_suggestMsgVideo2.innerHTML = suggestMsgVideo2+'&reg;';
	
	var _saveMsgVideo = document.getElementById('saveMsgVideo'+widgetType);
	_saveMsgVideo.innerHTML = saveMsgVideo;
	
	var _downloadModalVideoWrapper = document.getElementById('downloadModalVideoWrapper'+widgetType);
	_downloadModalVideoWrapper.style.display='block';
	
	var _downloadModalVideo = document.getElementById('downloadModalVideo'+widgetType);
	
	if(widgetType=='Songs') {
		_downloadModalVideo.style.marginTop=y+'px';
		_downloadModalVideo.style.marginLeft='292px';
	} else {
		_downloadModalVideo.style.marginTop='217px';
		_downloadModalVideo.style.marginLeft='65px';
	}
	
	if(url2=='') {
		_downloadLinkVideo2.style.display='none';
		_pixMsgVideo2.style.display='none';
		_suggestMsgVideo2.style.display='none';
		_downloadLinkVideo1.style.marginLeft='131px';
		_pixMsgVideo1.style.marginLeft='71px';
		_suggestMsgVideo1.style.marginLeft='71px';
		
	}
	
}



function openDownloadModal(url,successMsg,artistSong,saveMsg,buttonTxt,y) {
	
	initDownloadModal();
	
	var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;
	
	if (!ie7) {
		downloadModalLock();
		fadeWindow('downloadModalLock','in',0,20);
	}
	
	var _downloadLink = document.getElementById('downloadLink');
	var _successMsg = document.getElementById('successMsg');
	var _downloadModal = document.getElementById('downloadModal');
	
	_downloadModal.style.marginTop=y+'px';
	
	_downloadLink.setAttribute('href', unescape(url));
	
	_downloadLink.innerHTML=buttonTxt+_downloadLink.innerHTML;
	_successMsg.innerHTML=successMsg;
	
	/*document.getElementById('successMsg').style.backgroundColour = ;*/
	document.getElementById('artistSong').innerHTML=decodeURI(artistSong);
	document.getElementById('saveMsg').innerHTML=saveMsg;
	
	document.getElementById('downloadModalWrapper').style.display='block';
}


function initDownloadModal(x) {
	
	if (document.getElementById('downloadLink')!=null) {
		document.getElementById('downloadLink').href='';
		document.getElementById('downloadLink').innerHTML='';
	}
	
	if (document.getElementById('downloadLinkVideo1')!=null) {
		document.getElementById('downloadLinkVideo1').href='';
		document.getElementById('downloadLinkVideo1').innerHTML='';
	}
	
	if (document.getElementById('downloadLinkVideo2')!=null) {
		document.getElementById('downloadLinkVideo2').href='';
		document.getElementById('downloadLinkVideo2').innerHTML='';
	}
	
	if (document.getElementById('successMsg')!=null) {
		document.getElementById('successMsg').innerHTML='';
	}
	
	if (document.getElementById('successMsgVideo')!=null) {
		document.getElementById('successMsgVideo').innerHTML='';
	}
	
	if (document.getElementById('artistSong')!=null) {
		document.getElementById('artistSong').innerHTML='';
	}
	
	if (document.getElementById('artistSongVideo')!=null) {
		document.getElementById('artistSongVideo').innerHTML='';
	}
	
	if (document.getElementById('saveMsg')!=null) {
		document.getElementById('saveMsg').innerHTML='';
	}
	
	if (document.getElementById('saveMsgVideo')!=null) {
		document.getElementById('saveMsgVideo').innerHTML='';
	}
	
	if (document.getElementById('downloadModalWrapper')!=null) {
		document.getElementById('downloadModalWrapper').style.display='none';
		document.getElementById('downloadModalWrapper').style.marginTop=0;
	}
	
	if (document.getElementById('downloadModalVideoWrapperStore')!=null) {
		document.getElementById('downloadModalVideoWrapperStore').style.display='none';
	}
	
	if (document.getElementById('downloadModalVideoWrapperSongs')!=null) {
		document.getElementById('downloadModalVideoWrapperSongs').style.display='none';
	}
	
	var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;
	if(x!=null && !ie7){
		fadeWindow('downloadModalLock','out',80,20);
	}
}


function downloadModalLock() {
	var objBody = document.getElementsByTagName("body").item(0);
	var objHtml = document.getElementsByTagName("html").item(0);
	var objOverlay = document.createElement("div");
	var windowSizeY = document.body.clientHeight;
	objOverlay.setAttribute('id','downloadModalLock');
	objOverlay.style.height = windowSizeY + 'px';
	//objOverlay.style.display = 'none';
	objBody.appendChild(objOverlay);
	
}

