﻿// JScript File
var popUpWin = 0;
function popUpWindow(URLStr, iLeft, iTop, iWidth, iHeight, iName){
if(popUpWin){
	if(!popUpWin.closed) popUpWin.close();
} 
popUpWin = open(URLStr, iName, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,scrolling=1,width='+iWidth+',height='+iHeight+',left='+iLeft+', top='+iTop+',screenX='+iLeft+',screenY='+iTop+'');
}



function sendToActionscript(intIndex)
{
	resetContacts();
	
	var activeContact = document.getElementById('contact_'+intIndex);
	activeContact.setAttribute("class", "contactcard_active");
	activeContact.setAttribute("className", "contactcard_active");
	activeContact.setAttribute("onmouseover", "");
	activeContact.setAttribute("onmouseout", "");
	//activeContact.addEventListener("onclick", "");	
//alert("Till flash: " + parseInt(intIndex));
if (document.getElementById("contactswf")) { 
			document.getElementById("contactswf").sendToActionScript(parseInt(intIndex));
		}
}

/*function thisMovie(movieName) {
         if (navigator.appName.indexOf("Microsoft") != -1) {
             return window[movieName];
         } else {
             return document[movieName];
         }
     }

*/

function resetContacts() {
var divCollection = document.getElementsByTagName("div");
        for (var i=0; i<divCollection.length; i++) {
						if(divCollection[i].getAttribute("id") != null) {
            if(divCollection[i].getAttribute("id").substring(0,8) == "contact_") {
								if(divCollection[i].getAttribute("class") == "contactcard_active") {
									//alert("reset: " + divCollection[i].getAttribute("id").substring(8,divCollection[i].getAttribute("id").length))
								//resetContact(divCollection[i].getAttribute("id").substring(8,divCollection[i].getAttribute("id").length));
								divCollection[i].setAttribute("className", "contactcard");
								divCollection[i].setAttribute("class", "contactcard");
								//divCollection[i].setAttribute("onmouseover", "this.className=\'contactcard_active\';style.cursor=\'pointer\';");
								//divCollection[i].setAttribute("onmouseout", "this.className=\'contactcard\';style.cursor=\'Default\';");
								divCollection[i].onmouseover = function() { this.className='contactcard_active';this.style.cursor='pointer'; }
								divCollection[i].onmouseout = function() { this.className='contactcard';this.style.cursor='default'; }
								//divCollection[i].setAttribute("onclick", "sendToActionscript(" + divCollection[i].getAttribute("id").substring(8,divCollection[i].getAttribute("id").length) + ");");

																																										}
																																									} 
																														}
																										}
												}




function sendToJavaScript(intIndex)
{
	resetContacts();
	//alert("Från flash: " + parseInt(intIndex));
	var activeContact = document.getElementById('contact_'+parseInt(intIndex));
	activeContact.setAttribute("class", "contactcard_active");
	activeContact.setAttribute("className", "contactcard_active");
	activeContact.setAttribute("onmouseover", "");
	activeContact.setAttribute("onmouseout", "");
	}