function PopWin(URL,Name,Features) {
	window.open(URL,Name,Features);
}

var expDays = 1; // number of days the cookie should last

//var page = "http://www.domain.com/.html";
//var windowprops = "width=344,height=498,location=no,toolbar=no,menubar=no,buttons=no,status=no,directories=no,scrollbars=no,resizable=no";

function GetCookie (name) {  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) {    
var j = i + alen;    
if (document.cookie.substring(i, j) == arg)      
return getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) break;   
}  
return null;
}
function SetCookie (name, value) {  
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);  
var cval = GetCookie (name);  
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*12*60*60*1000));
function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
return 1
}
else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
   }
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function checkCount() {
var count = GetCookie('count');
if (count == null) {
count=1;
SetCookie('count', count, exp);

//window.open(page, "", windowprops);

}
else {
count++;
SetCookie('count', count, exp);
   }
}

<!-- Check for and read a cookie -->

function getCookie(Name) {
	var search = Name + "="
	if (document.cookie.length > 0) { // if there are any cookies
		offset = document.cookie.indexOf(search) 
		if (offset != -1) { // if cookie exists 
			offset += search.length 
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset) 
			// set index of end of cookie value
			if (end == -1) 
				end = document.cookie.length
				return unescape(document.cookie.substring(offset, end))
		} 
	}
}

<!-- Read it -->
function ReadCookie (name) {  
    var arg = name + "=";  
    var alen = arg.length;  
    var clen = document.cookie.length;  
    var i = 0;  
    while (i < clen) {    
    var j = i + alen;    
    if (document.cookie.substring(i, j) == arg)      
            return getCookieVal (j);    
            i = document.cookie.indexOf(" ", i) + 1;    
            if (i == 0) break;   
    }  
    return null;
}

<!-- Get it's value -->
function getCookieVal (offset) {  
    var endstr = document.cookie.indexOf (";", offset);  
    if (endstr == -1)    
            endstr = document.cookie.length;  
            return unescape(document.cookie.substring(offset, endstr));
}

<!-- Check for a cookie to see if they have disabled the survey popup -->
<!-- If they have NOT disabled it, pop it up -->
function popIt(){
	if (getCookie("survey_pop_disable") == null) {
		SpawnChild("survey_popup.php","child","550","350","yes","0","0","0","0","0","0","0","0","0")
	}else{
		disable = parseInt(ReadCookie("survey_pop_disable"))
		if (disable == "false"){
			SpawnChild("survey_popup.php","child","550","350","yes","0","0","0","0","0","0","0","0","0")
		}
	}
}

function ValidateEmail()
{
	ErrList = ""

  if(document.all.ri_from_email.value == "")
    ErrList = ErrList + "Your Email\n"

  if(document.all.ri_from_name.value == "")
    ErrList = ErrList + "Your Name\n"

	if(ErrList != "")
	{
		alert("Missing required fields:\n\n" + ErrList)
		return false
	}
}

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 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_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_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];}
}


var beg = "<a href=\"";
var mid = "\"><img border=\"0\" src=\"";
var nex = "\" alt=\"";
var end = "\" width=\"341\" height=\"256\" border=\"0\ target=\"_blank\"></a>";
var links = new Array();
var images = new Array();
var alttext = new Array();

links[0] = "http://www..com";
images[0] = "images/loft_interior.jpg";
alttext[0] = ".com";
links[1] = "http://www..com";
images[1] = "images/loft_interior_2.jpg";
alttext[1] = ".com";
links[2] = "http://www..com";
images[2] = "images/loft_interior_3.jpg";
alttext[2] = ".com";
links[3] = "http://www..com";
images[3] = "images/loft_interior_4.jpg";
alttext[3] = ".com";
links[4] = "http://www..com";
images[4] = "images/loft_interior_5.jpg";
alttext[4] = ".com";
links[5] = "http://www..com";
images[5] = "images/loft_interior_6.jpg";
alttext[5] = ".com";
links[6] = "http://www..com";
images[6] = "images/loft_interior_7.jpg";
alttext[6] = ".com";
links[7] = "http://www..com";
images[7] = "images/loft_interior_8.jpg";
alttext[7] = ".com";

var rannum1 = Math.floor(Math.random() * images.length)
var rannum2;
do
{
rannum2 = Math.floor(Math.random() * images.length)
}
while (rannum2 == rannum1)
var rannum3;
do
{
rannum3 = Math.floor(Math.random() * images.length)
}
while ((rannum3 == rannum1) || (rannum3 == rannum2))

function selectPicture(name)
{
   document.images.bigPicture.src = name;
}

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 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_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_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]; }
}

