function popUp(url) {
sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
self.name = "mainWin";
}

function OpenWin(NRCHANNELGUID,NRNODEGUID,wbc_resource,wbc_phname,client){
var url = "/AlcanCable/CMS/WebAuthor/Dialogs/ResourceBrowser/Authoring/AttachmentPropertiesBrowse.aspx?NRMODE=Unpublished&NRCHANNELGUID=" + NRCHANNELGUID + "&FRAMELESS=true&NRNODEGUID=" + NRNODEGUID + "&wbc_phname=" + wbc_phname + "&wbc_phtype=SingleAttachment&wbc_deskres=true&wbc_attachicon=true&wbc_video=false&wbc_resource=" + wbc_resource
window.open(url);
client.style.visibility = 'hidden';
return ;

}

function DisplayArosMessage(){
 // if(alert('A new version of the AROS software is available as of March 6th 2006.  The software should install automatically on your computer just as past versions have.  You must have administrator rights on your computer for the software to install properly.\r\n\r\nEnhancements include:\r\n\r\nA new price adjustable order type (USA)\r\nAutomated Ship-To Address (like PRMS, reduce manual input)\r\nShip-To Inquiry\r\nShip-To Maintenance\r\nWarehouse Product Profile Inquiry\r\nMenus designed specifically for stocking and non-stocking locations.\r\n\r\n\r\n If you do not see these enhancements in your AROS Software, please contact your helpdesk to install these updates(administrator privileges required on your pc for update)')){
	return true;
//  }else return true;

}
//handle external links
//Enter "_blank" for new window (each time), "window2" for a set secondary window
var newwindow="_blank"

function hyperlinks(target){
   if(lang == null) lang = "en-US";
   var outLink = "/alcancable/" + lang + "/legaldisclaimeroutsidelinks.htm?Url=";
   if (target) where = newwindow;
   else where = "_top";
	for (var i=0; i<=(document.links.length-1); i++){
		var linkobj=document.links[i].href
		// custom
		DocURL = linkobj;
		protocolIndex=DocURL.indexOf("://",4);
		serverIndex=DocURL.indexOf("/",protocolIndex + 3);
		BeginURL=DocURL.indexOf("#",1) + 1;
		urlresult=DocURL.substring(BeginURL,serverIndex);
		displayresult=DocURL.substring(protocolIndex + 3 ,serverIndex);
			if((displayresult.indexOf("alcan.com") == -1) && (displayresult.indexOf("cable.alcan.com") == -1)&& (displayresult.indexOf("alcancable.com") == -1) &&(displayresult.indexOf("prewiredsystems.net")== -1)&&(displayresult.indexOf("localhost") == -1)&& (displayresult.indexOf("alcan.com") == -1) &&(displayresult.indexOf("atl-cabledev01") == -1)&&(displayresult.indexOf("atl-cabledev02") == -1)&&(displayresult.indexOf("atl-cablestg01") == -1))
			{
				
				if ( linkobj.indexOf("javascript:") ==-1 && linkobj.indexOf("#") ==-1 && linkobj.indexOf("mailto:") ==-1)
				{
   					//if (target && where!="_blank") //DynamicDrive.com added routine- open window in set secondary window
   						
      					document.links[i].onclick=function(){
							if (window.window2 && !window2.closed)
							window2.location= outLink + encodeURIComponent(this.href) ;
							else
        					window2=window.open(outLink + encodeURIComponent(this.href));
							window2.focus()
      						return false
      							}
   				//	else{
   				//		//alert(linkobj);
      			//		if (newwindow=="window2") document.links[i].onclick = "";    
      			//		document.links[i].target = where;
       			//		}
   				}
			}
			if(linkobj.indexOf("mms://") != -1)
			{

				link = "/alcancable/includes/playmedia.asp?movie=" +  encodeURIComponent(linkobj) + "." ;
				
				document.links[i].onclick=function(){
						window.showModalDialog(link,"", "scroll:no;dialogHeight:575px;dialogWidth:663px;center:yes;resizable:no;status:no;"); 
      					return false
      						}
			}
			if ((linkobj.indexOf(".pdf") !=-1) || (linkobj.indexOf(".doc") !=-1))
			{
   				if (target && where!="_blank") 
      				document.links[i].onclick=function(){
						if (window.window2 && !window2.closed)
							window2.location=this.href
						else
        					window2=window.open(this.href)
							window2.focus()
      						return false
      						}
   				else{
      				if (newwindow=="window2") document.links[i].onclick = "";    
      				document.links[i].target = where;
       				}
   			}
		
			
		}
}

function inithyperlinks(){    //DynamicDrive.com added routine
	hyperlinks(true)
}

window.onload=inithyperlinks

function showhide(obj){
        var displayed = document.all.item(obj).style.display=='' ? 'yes' : 'no'
if (displayed=='yes')
	{
document.all.item(obj).style.display='none';
//document.images ['plusminus'] . src  = "/NR/ContentConnector/CS2000/SiteInterface/Images/Alcan_Images/plus.gif";
	}
else if (displayed=='no')
	{
document.all.item(obj).style.display='';
//document.images ['plusminus'] . src  = "/NR/ContentConnector/CS2000/SiteInterface/Images/Alcan_Images/minus.gif";
	}
}

//********************************** drag ****************************
function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

// Global object to hold drag information.

var dragObj = new Object();
dragObj.zIndex = 0;

function dragStart(event, id) {

  var el;
  var x, y;

  // If an element id was given, find it. Otherwise use the element being
  // clicked on.

  if (id)
    dragObj.elNode = document.getElementById(id);
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.

  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Update element's z-index.

  dragObj.elNode.style.zIndex = ++dragObj.zIndex;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.

  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {

  // Stop capturing mousemove and mouseup events.

  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}

//******************************** end drag *******************************

function chgPlant(source)
		{		
			targetDiv = document.getElementById("DisplayText1");
			sourceDiv = document.getElementById(source);
			targetDiv.innerHTML=sourceDiv.innerHTML;
			targetDiv.style.display='';
						
			
		}
		var prev;
		function chgPlantRelative(source)
		{		
			//if(prev != null) prev.style.display='none';
			sourceDiv = document.getElementById(source);
			var displayed = (sourceDiv.style.display=='none' ? 'no' : 'yes');
			if(displayed == "yes")sourceDiv.style.display='none';
			else sourceDiv.style.display='';
			prev = sourceDiv;
			
		}
		
		
	function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
