<!--

var imageWin;

function bigImage(sPath, sAlt, iWidth, iHeight){
	sURL = '/pages/viewimage.asp?Path=' + sPath + '&alt=' + sAlt
	var popWin = imageWin;
	
	if(popWin && !popWin.closed){
		popWin.close();
	}
	
	iWidth = iWidth + 20
	iHeight = iHeight + 20

	imageWin = window.open(sURL, 'imageWin','status=yes,scrollbars=no,resizable=yes,left=0,top=0,width=' + iWidth +',height=' + iHeight);

}

function checkSideSearch(){
	var f = document.frmSideSearch
	
	if(f.Sector.selectedIndex == 0){
		f.PageID.value='94'
	}else{
		document.frmSideSearch.PageID.value='134'
	}
	
}

function chooseMedia(sDest, sCat, bFixed){
	openEditWin('../medialibrary/MediaChooseImage.asp?CatID='+sCat+'&dest='+sDest+'&CatFixed='+bFixed,'600','290')
}

function cOn(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#CC0000";
}
}

function cOut(td){
if(document.getElementById||(document.all && !(document.getElementById))){
td.style.backgroundColor="#C1B5AA";
}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function openEditWin(theURL, theWidth, theHeight){
	var myDate = new Date();
	var winName = 'EditWin'+myDate.getMinutes()+myDate.getMilliseconds()
	MM_openBrWindow(theURL, winName,'status=yes,scrollbars=yes,resizable=yes,left=0,top=0,width=' + theWidth +',height=' + theHeight);
}

function goURL(theURL){
	var aURL = new Array("http", "ftp", "https");
	
	var external = false;
	var newwin = false;
	
	for(i=0;i<aURL.length;i++){
		sURL = aURL[i] + '://';
		if(theURL.substr(0, sURL.length) == sURL){
			external = true;
			newwin = true;
			break;
		}
	}
	
	thisServer = 'http://www.square.co.uk' //set above
	
	if(theURL.substr(0, thisServer.length) == thisServer){external = false}
	
	thisServer = 'http://squareonepharma.co.uk'

	if(theURL.substr(0, thisServer.length) == thisServer){external = false}
	
	var go = true
	
	if(external){
		go = confirm(externalWarning)
	}

	if(go){
		if(newwin){
			window.open(theURL)
		}
		else{
			document.location.href = theURL
		}
	}
}

function YY_checkform() { //v4.65
//copyright (c)1998,2002 Yaromat.com
  var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;
  for (var i=1; i<args.length;i=i+4){
    if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}
    var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));
    myV=myObj.value;
    if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){
      if (myReq&&myObj.value.replace(/\W/g, '').length==0){addErr=true}
      if ((myV.length>0)&&(args[i+2]==1)){ //fromto
        var myMa=args[i+1].split('_');if(isNaN(parseInt(myV))||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==2)){
          var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;
      } else if ((myV.length>0)&&(args[i+2]==3)){ // date
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);
        if(myAt){
          var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
          var myDate=new Date(myY,myM,myD);
          if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
        }else{addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==4)){ // time
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
      } else if (myV.length>0&&args[i+2]==5){ // check this 2
            var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
            if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!myObj1.checked){addErr=true}
      } else if (myV.length>0&&args[i+2]==6){ // the same
            var myObj1 = MM_findObj(args[i+1]);
            if(myV!=myObj1.value){addErr=true}
      }
    } else
    if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
          var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
          var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
      if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
      if (args[i+2]==2){
        var myDot=false;
        for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
        if(!myDot){myErr+='* ' +args[i+3]+'\n'}
      }
    } else if (myObj.type=='checkbox'){
      if(args[i+2]==1&&myObj.checked==false){addErr=true}
      if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
    } else if (myObj.type=='select-one'||myObj.type=='select-multiple'){
      if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
    }else if (myObj.type=='textarea'){
			myV = myV.replace(/\W/g, '');
      if(myV.length<args[i+1]){addErr=true}
    }
    if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}
  }
  if (myErr!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+myErr)}
  document.MM_returnValue = (myErr=='');
}

function showhide(){
		var row1;
		var row2;
		if(document.all){
			row1 = document.all.row1;
			row2 = document.all.row2;
		}
		else{
			if(document.getElementById){
				row1 = document.getElementById('row1');
				row2 = document.getElementById('row2');
			}	
		}
		
		if(row1){
			if(row1.style.display == 'none'){
				row1.style.display ='';
			}else{
				row1.style.display ='none';
			}
			if(row2.style.display == 'none'){
				row2.style.display ='';
			}else{
				row2.style.display ='none';
			}
			return false;
		}
		
}

function flashOrImage(sPath, sWidth, sHeight, sAltPath, sAltWidth, sAltHeight, sAlt, sPosition, sLink){

	// in this section we set up the content to be placed dynamically on the page
	// customize movie tags and alternate html content below
	
	if (!useRedirect) {		// if dynamic embedding is turned on
		if(hasRightVersion) {	// if we've detected an acceptable version

			flashOnly(sPath, sWidth, sHeight);

		} else {	// flash is too old or we can't detect the plugin

			var alternateContent = '';
			if(sLink != ''){alternateContent += '<a href="javascript:goURL(\'' + sLink + '\');">';}
			alternateContent += '<img src="/media/uploads/' + sAltPath + '" name="ContentImage' + sPosition + '" alt="' + sAlt + '" width="' + sAltWidth + '" height="' + sAltHeight + '" border="0" />';
			if(sLink != ''){alternateContent += '</a>';}
	
			document.write(alternateContent);	// insert non-flash content
		}
	}
}


function flashOnly(sPath, sWidth, sHeight){

	var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + sWidth + '" height="' + sHeight + '">';
	oeTags += '<param name="movie" value="../media/uploads/' + sPath + '" />';
	oeTags += '<param name="quality" value="high" />';
	oeTags += '<embed src="../media/uploads/' + sPath + '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + sWidth + '" height="' + sHeight + '"></embed>';
	oeTags += '</object>'
	
	document.write(oeTags); 	// embed the flash movie
}

var nlWin;

function popPage(pageId) {
	if(nlWin && !nlWin.closed){
		nlWin.location.href = '/pages/content.asp?PageID=' + pageId;
		nlWin.focus();
	}
	else{
		nlWin = window.open('/pages/content.asp?PageID=' + pageId, 'popPage','resizable=yes,width=330,height=355,scrollbars=yes');
	}
	
	if(!nlWin){
		alert('Popup blocked - please check your popup blocking software.')
	}
}

//-->