// Miscellaneous scripts

var bAgent = window.navigator.userAgent;
var bAppName = window.navigator.appName;
if ( (bAppName.indexOf("Netscape") >= 0) &&
(bAgent.indexOf("Mozilla/4") >= 0) && (bAgent.indexOf("Win") >= 0) )
{  document.write (' <link rel="stylesheet" href="/css/mainWinnn.css" type ="text/css">' )
}
else if ( (bAppName.indexOf("Explorer") >= 0) &&
(bAgent.indexOf("Mozilla/4") >= 0) && (bAgent.indexOf("Win") >= 0) )
{document.write (' <link rel="stylesheet" href="/css/mainWinie.css" type="text/css">' )
}
else if ( (bAppName.indexOf("Explorer") >= 0) &&
(bAgent.indexOf("Mozilla/4") >= 0) && (bAgent.indexOf("Mac") >= 0) )
{document.write (' <link rel="stylesheet" href="/css/mainMacie.css" type="text/css">' )
}
else if ( (bAppName.indexOf("Netscape") >= 0) &&
(bAgent.indexOf("Mozilla/4") >= 0) && (bAgent.indexOf("Mac") >= 0) )
{document.write (' <link rel="stylesheet" href="/css/mainMacnn.css" type="text/css">' )
}
else {document.write (' <link rel="stylesheet" href="/css/mainWinnn.css" type="text/css">' ) 
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
} 

function wrpopup(){
	window.open("/pop1old.html","noel","width=300,height=500,resizable=no,scrollbars=no")
	};

// script for opening and closing faq sub window
var answerDoc

function answerMe(file,name,size) {
	answerDoc = window.open (file,name,size)
	answerDoc.document.close()
} 

function closeAnswerDoc() {
	if (answerDoc && !answerDoc.closed) {
		answerDoc = answerDoc.close()
	}
}

function newWin(file,name,features) {
	answerDoc = window.open (file,name,features)
	answerDoc.document.close()
}

// function for openening new windows for external links in advice centre
var popUp 
function externalPopUp(file,name, features) {
	popUp = window.open (file,name,features);
	
}

function killPopUp() {
	if (popUp && !popUp.closed) {
		popUp = popUp.close()
	}
}

// function for drug search
function popwin(url) {
sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0, status=1,menubar=1,scrollbars=1,resizable=1,width=660,height=420');
self.name = "mainWin"; }

// function for site seal in Superstore
function siteseal(url) {
sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0, status=1,menubar=1,scrollbars=1,resizable=1,width=660,height=420');
self.name = "mainWin"; }

// functions for registration pages
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// function to test pop up window
function newWin(url,title,features) {
	window.open (url,title,features)
	
}

function passwdtest (form){
		
		if (form.password.value == form.password2.value) {			
			return (true);
			}
		else{ return (false);}
}

function wr_passwdtest (form){
		
		if (form.new_wr_password.value == form.new_wr_password2.value) {			
			return (true);
			}
		else{ return (false);}
}


function emailCheck(form) {
      if(form.email.value.indexOf('@', 0) == -1)
        return (false);
      else
        return (true);
}

function wr_passwdlen (form){
		
		if (form.new_wr_password.value.length < 1 || form.new_wr_password.value.length > 4) {			
			return (true);
			}
		else{ return (false);}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

// functions from affiliates

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// functions from drug pop up in AC
function newWin(file,name,features) {
	answerDoc = window.open (file,name,features)
	answerDoc.document.close()
}

function closeAnswerDoc() {
	if (answerDoc && !answerDoc.closed) {
		answerDoc = answerDoc.close()
	}
}
// too many newWins trying out new one for Mews link to TV listings
function tvToday()
{
window.open
("http://www.mydigiguide.com/", "new_window", "width=650,height=400,scrollbars");
}
// function to test pop up window
function newWin(url,title,features) {
	window.open (url,title,features)
	
}	
	
