//Fuctions to mimmick LTrim,  RTrim, and Trim...
//==================================================================
//LTrim(string) : Returns a copy of a string without leading spaces.
//==================================================================
function LTrim(str)
/*
        PURPOSE: Remove leading blanks from our string.
        IN: str - the string we want to LTrim
*/
{
        var whitespace = new String(" \t\n\r");

        var s = new String(str);

        if (whitespace.indexOf(s.charAt(0)) != -1) {
            // We have a string with leading blank(s)...

            var j=0, i = s.length;

            // Iterate from the far left of string until we
            // don't have any more whitespace...
            while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
                j++;


            // Get the substring from the first non-whitespace
            // character to the end of the string...
            s = s.substring(j, i);
        }

        return s;
}

//==================================================================
//RTrim(string) : Returns a copy of a string without trailing spaces.
//=================================================================//=
function RTrim(str)
/*
        PURPOSE: Remove trailing blanks from our string.
        IN: str - the string we want to RTrim

*/
{
        // We don't want to trip JUST spaces, but also tabs,
        // line feeds, etc.  Add anything else you want to
        // "trim" here in Whitespace
        var whitespace = new String(" \t\n\r");

        var s = new String(str);

        if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
            // We have a string with trailing blank(s)...

            var i = s.length - 1;       // Get length of string

            // Iterate from the far right of string until we
            // don't have any more whitespace...
            while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
                i--;


            // Get the substring from the front of the string to
            // where the last non-whitespace character is...
            s = s.substring(0, i+1);
        }

        return s;
}


//=============================================================
//Trim(string) : Returns a copy of a string without leading or trailing spaces
//=============================================================
        function Trim(str)
        /*
                PURPOSE: Remove trailing and leading blanks from our string.
                IN: str - the string we want to Trim

                RETVAL: A Trimmed string!
        */
        {
                return RTrim(LTrim(str));
        }



function validEmail(email) {
	 invalidChars = " /:,;"
	
	if (email == "") {	// cannot be empty
	    //alert("Please enter your email address.");
	    return false
         }
	for (i=0; i<invalidChars.length; i++) {	// does it contain any invalid characters?
	badChar = invalidChars.charAt(i)
	if (email.indexOf(badChar,0) > -1) {
	   return false
	}
      }
      atPos = email.indexOf("@",1)	// there must be one "@" symbol
      if (atPos == -1) {
	 return false
      }
      if (email.indexOf("@",atPos+1) != -1) {	// and only one "@" symbol
	  return false
      }
      periodPos = email.indexOf(".",atPos)
      if (periodPos == -1) {			// and at least one "." after the "@"
	 return false
      }
      if (periodPos+3 > email.length)	{ // must be at least 2 characters after the "."
	 return false
      }
      return true
}


CSInit = new Array;
function CSScriptInit() {
if(typeof(skipPage) != "undefined") { if(skipPage) return; }
idxArray = new Array;
for(var i=0;i<CSInit.length;i++)
	idxArray[i] = i;
CSAction2(CSInit, idxArray);}
CSAg = window.navigator.userAgent; CSBVers = parseInt(CSAg.charAt(CSAg.indexOf("/")+1),10);
function IsIE() { return CSAg.indexOf("MSIE") > 0;}
function CSIEStyl(s) { return document.all.tags("div")[s].style; }
function CSNSStyl(s) { return CSFindElement(s,0); }
function CSFindElement(n,ly) { if (CSBVers < 4) return document[n];
	var curDoc = ly ? ly.document : document; var elem = curDoc[n];
	if (!elem) { for (var i=0;i<curDoc.layers.length;i++) {
		elem = CSFindElement(n,curDoc.layers[i]); if (elem) return elem; }}
	return elem;
}

function CSClickReturn () {
	var bAgent = window.navigator.userAgent; 
	var bAppName = window.navigator.appName;
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return true; // dont follow link
	else return false; // dont follow link
}

function CSButtonReturn () {
	var bAgent = window.navigator.userAgent; 
	var bAppName = window.navigator.appName;
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return false; // follow link
	else return true; // follow link
}

CSIm = new Object();
function CSIShow(n,i) {
	if (document.images) {
		if (CSIm[n]) {
			var img = (!IsIE()) ? CSFindElement(n,0) : document[n];
			if (img && typeof(CSIm[n][i].src) != "undefined") {img.src = CSIm[n][i].src;}
			if(i != 0)
				self.status = CSIm[n][3];
			else
				self.status = " ";
			return true;
		}
	}
	return false;
}
function CSILoad(action) {
	im = action[1];
	if (document.images) {
		CSIm[im] = new Object();
		for (var i=2;i<5;i++) {
			if (action[i] != '') { CSIm[im][i-2] = new Image(); CSIm[im][i-2].src = action[i]; }
			else CSIm[im][i-2] = 0;
		}
		CSIm[im][3] = action[5];
	}
}
CSStopExecution = false;
function CSAction(array) { 
	return CSAction2(CSAct, array);
}
function CSAction2(fct, array) { 
	var result;
	for (var i=0;i<array.length;i++) {
		if(CSStopExecution) return false; 
		var actArray = fct[array[i]];
		if (actArray == null) return false;
		var tempArray = new Array;
		for(var j=1;j<actArray.length;j++) {
			if((actArray[j] != null) && (typeof(actArray[j]) == "object") && (actArray[j].length == 2)) {
				if(actArray[j][0] == "VAR") {
					tempArray[j] = CSStateArray[actArray[j][1]];
				}
				else {
					if(actArray[j][0] == "ACT") {
						tempArray[j] = CSAction(new Array(new String(actArray[j][1])));
					}
				else
					tempArray[j] = actArray[j];
				}
			}
			else
				tempArray[j] = actArray[j];
		}			
		result = actArray[0](tempArray);
	}
	return result;
}
CSAct = new Object;

CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'home',/*URL*/'images/top_home_off.gif',/*URL*/'images/top_home_on.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'about us',/*URL*/'images/topnav_about_off.gif',/*URL*/'images/topnav_about_on.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'contact us',/*URL*/'images/top_contact_off.gif',/*URL*/'images/top_contact_on.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'site map',/*URL*/'images/top_sitemap_off.gif',/*URL*/'images/top_sitemap_on.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'feedback',/*URL*/'images/top_feedback_off.gif',/*URL*/'images/top_feedback_on.gif',/*URL*/'','');

function measure(n) {
	this.length=n;
	for (var i=1;i<=n;i++) {
		this[i]=0 }
	return this
}
month=new measure(12);
month[1]="January"
month[2]="February"
month[3]="March"
month[4]="April"
month[5]="May"
month[6]="June"
month[7]="July"
month[8]="August"
month[9]="September"
month[10]="October"
month[11]="November"
month[12]="December"

day=new measure(7);
day[1]="Sunday"
day[2]="Monday"
day[3]="Tuesday"
day[4]="Wednesday"
day[5]="Thursday"
day[6]="Friday"
day[7]="Saturday"

function writedate() {
		 display=new Date();
		 document.write(day[display.getDay()+1]+", "+month[display.getMonth()+1]+" "+display.getDate()+", "+display.getFullYear());
}



function convertSpaces(str) {
//trim leading spaces
while(''+str.charAt(0)==' ')
str=str.substring(1,str.length);
//trim trailing spaces
while(''+str.charAt(str.length-1)==' ')
str=str.substring(0,str.length-1);
//convert serveral spaces into one space
var out = "", flag = 0;
for (i = 0; i < str.length; i++) {
if (str.charAt(i) != " ") {
out += str.charAt(i);
flag = 0;
}
else {
if(flag == 0) {
out += " ";
flag = 1;
      }
   }
}
return out;
}


function counter(str) {
var count = 0 
var flag = 0;
var str = Trim(str);
if (str.length > 0) {
	count = 1;
	}
//updated count method 2005-07-26 to 
//take into consideration of non-space whitespace
var pattern = /\s+/gi;
var result = str.match(pattern);
if (result != null) {
 	count = result.length + 1;
	}
//for (i = 0; i < str.length; i++) {
//if (str.charAt(i) != " ") {
//    if (flag == 0) {
//        count += 1;
//	}
//    else {
//	count = count;
//	}
//flag = 1;
//}
//else {
//flag = 0;
//  }
//}
return count;
}


//This function is used to take care of the cases where OnKeyDown and OnKeyUp are not supported.
function ClassifiedCounter(field, textfield, editionfield, totalfield) {
var w;
var e = editionfield.value - 0;
var prtEdition;
var nweek = 0;
var string1 = " ";
var totalamt;
//Count the number of words in the description field
if (field.value != "undefined" && field.value != "null" && field.value != null) {
string1 = field.value
}
textfield.value = counter(string1);
w = textfield.value - 0;
//Calculte ad total
adtotal(w, e);
}


function CalculateFinalCost() {
	if (document.classified.Discount != null) {
		if (!isNaN(document.classified.Discount.value)) {
		discount = document.classified.Discount.value;
		total = document.classified.Total.value;
		document.classified.Final_Cost.value = FormatNumberAsMoney(total - (total * discount));
		}
	}
}

function CalculateDiscountedPrice(regularprice) {
	var discountedprice = regularprice - 0;
	if (document.classified.Discount != null) {
		if (!isNaN(document.classified.Discount.value)) {
		discount = document.classified.Discount.value;
		discountedprice = FormatNumberAsMoney(regularprice - (regularprice * discount));
		}
	}
	return discountedprice;
}


//This function calculates ad total
function adtotal(wordcount, editioncount){
var w = wordcount - 0;
var e = editioncount - 0;
var nweek;
//Calculate the number of printed editions
var prtEdition = e; 
//Calculate the number of weeks to run
if (parseInt(document.classified.Weeks.value) != 0 && !isNaN(parseInt(document.classified.Weeks.value))) {
nweek = parseInt(document.classified.Weeks.value);
}
else { 
nweek = 0;
}
//Calculate ad total
if (w != 0 && prtEdition != 0) {
	//If the last button of the category field is checked
	//2004-10-26: set to the same rate as other categories
	if (document.classified.Category[4].checked) {
		if (w > 20){
		totalamt = nweek*(3 + (7*prtEdition) + (w - 20)*prtEdition/10.00);
		}

		else {
		totalamt = nweek*(3 + (7*prtEdition))
		}
	}
	else {
		if (w > 20){
		totalamt = nweek*(3 + (7*prtEdition) + (w - 20)*prtEdition/10.00);
		}
		else {
		totalamt = nweek*(3 + (7*prtEdition))
		}
	}
}
else {
totalamt = 0;
}
document.classified.Total.value = FormatNumberAsMoney(totalamt);
}

function FormatToHundredths(N)
{
	return Math.floor((parseFloat(N) + 0.005) * 100) / 100
}

function FormatNumberAsMoney(N)
{
	if (parseFloat(N) == 0)
	{
		return "0.00"
	}
	else
	{
		N = (this.FormatToHundredths(N)).toString()
		var index = N.indexOf(".")
		var cents = N.substring(index + 1, N.length)
		if (index == -1) N += ".00"
		else if (cents.length < 2) N += "0" 
		return N
	} 
}

//Calculate total as the check boxes are checked
function checkboxCounter(field, textfield, editionfield, totalfield) {
var w = textfield.value - 0;
var e = editionfield.value - 0;
var prtEdition;
var nweek = 0;
if (field.checked) {
e = e + 1;
}

else {
e = e - 1;
}
//assign new value to the total edition field
editionfield.value = e;
//calculate ad total;
adtotal (w, e);
}

function WordCount() {
var w = 0;
var description = document.classified.Description.value;
w = counter(description);
return w;  
}					  

function GVPSEditions() {
var e = 0;
fieldname = document.classified.Editions;
for (m=0; m<fieldname.length; m++) {
	if (document.classified.Editions[m].checked) {
		e = e + 1;
		}
	}
return e;	
}

function GetWeeks() {
var nweek;
if (parseInt(document.classified.Weeks.value) != 0 && !isNaN(parseInt(document.classified.Weeks.value))) {
	nweek = parseInt(document.classified.Weeks.value);
	}
	else { 
	nweek = 0;
	}
return nweek;
}

function CalculateTotal() {
word_count = WordCount();	
gvps_editions = GVPSEditions();
weeks = GetWeeks();
gvps_subtotal = GVPSSubtotal(word_count, gvps_editions, weeks);
gvps_discounted = CalculateDiscountedPrice(gvps_subtotal) - 0.00;
southerntier_subtotal = SoutherntierSubtotal(word_count, weeks);
total = gvps_discounted + southerntier_subtotal;
//total = gvps_subtotal + southerntier_subtotal;

document.classified.Word_Count.value = word_count;
document.classified.Number_of_Editions.value = gvps_editions;
if (weeks > 0) {
	document.classified.Weeks.value = weeks;
	}
	else {
	document.classified.Weeks.value = "";
	}
document.classified.Southerntier_Subtotal.value = FormatNumberAsMoney(southerntier_subtotal);
document.classified.GVPS_Subtotal.value = FormatNumberAsMoney(gvps_subtotal);
//document.classified.GVPS_Total.value = FormatNumberAsMoney(gvps_discounted);
document.classified.Total.value = FormatNumberAsMoney(total);
}


//For free classified ads submission form/
function CalculateFreeTotal() {
word_count = WordCount();	
document.classified.Word_Count.value = word_count;
if (word_count > 10) {
	//alert("You can only enter up to 10 words. \nGo to our Classified Ads form if you need to place an ad with more than 10 words.");
	//return false;
	}

gvps_editions = GVPSEditions();
weeks = 1;
total = 0;

if (gvps_editions > 1) {
	total = 5 * (gvps_editions-1);
}

document.classified.Number_of_Editions.value = gvps_editions;
document.classified.Total.value = FormatNumberAsMoney(total);
return true;
}


function CheckFreeClassified(thisform) {
	CalculateFreeTotal();
	if (WordCount() <= 10) {
		if (ValidateForm(thisform) == false) {
			return false;
		}
		else {
			if (document.classified.Total.value > 0) {
				//validate credit card info
				if (Trim(document.classified.Card_Number.value).length==0) {
					alert("Please enter your credit card number.");
					document.classified.Card_Number.focus();
					return false;
				} 
				if (Trim(document.classified.Exp_Date.value).length==0) {
					alert("Please enter your credit card expiration date.");
					document.classified.Exp_Date.focus();
					return false;
				} 
				if (Trim(document.classified.CVC.value).length==0) {
					alert("Please enter your credit card CVC.");
					document.classified.CVC.focus();
					return false;
				} 
			}
			
		}
		
	}
	else {
		//alert("You can only enter up to 10 words. \nGo to our Classified Ads form if you need to place an ad with more than 10 words.");
		freeadwin = window.open( '_pop_freead.asp', 'freeadwin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=1,copyhistory=no,width=400,height=300' );
		freeadwin.focus();
		return false;
	}
}


//For free classified ads submission form/

function CalculateWordDirTotal() {
word_count = WordCount();	
gvps_editions = GVPSEditions();
total = 0.00;
if (document.classified.Commitment[0].checked) {
	total = 104*gvps_editions;
	}
if (document.classified.Commitment[1].checked) {
	total = 208*gvps_editions;
	}
document.classified.Word_Count.value = word_count;
document.classified.Number_of_Editions.value = gvps_editions;
document.classified.Total.value = FormatNumberAsMoney(total);
if (word_count > 10) {
	alert("You can only enter up to 10 words.");
	return false;
	}
}

function GVPSSubtotal(word_count, gvps_editions, weeks) {
var w = word_count - 0;
var prtEdition = gvps_editions;
var nweek = weeks;
var totalamt = 0; 

if (w != 0 && prtEdition != 0) {
	if (w > 20){
		totalamt = nweek*(3 + (7*prtEdition) + (w - 20)*prtEdition/10.00);
		}

	else {
		totalamt = nweek*(3 + (7*prtEdition))
		}
	}
	
// Add photo option price 
if (document.classified.Photo != null) {
	if (Trim(document.classified.Photo.value) != "") {
		totalamt = totalamt + (nweek*5.00)
		}
	}

return totalamt;
}

function SoutherntierSubtotal(word_count, weeks) {
var wordcount = word_count - 0;
var subtotal = 0.00;
nweek = weeks;
if (wordcount > 0) {
	fieldname = document.classified.Southerntier_Editions;
	for (m=0; m<fieldname.length; m++) {
		if (fieldname[m].checked) {
			fieldvalue = fieldname[m].value;
			
			fieldvalue = fieldvalue.toLowerCase();
			if (fieldvalue.indexOf("morris") > -1) {
				if (wordcount > 20) {subtotal = subtotal + 7.00 + (wordcount-20)*0.1} else {subtotal= subtotal + 7.00}
				if (document.classified.Photo != null) {
					if (Trim(document.classified.Photo.value) != "") {
						subtotal = subtotal + 6.00
						}
					}
				}
			if (fieldvalue.indexOf("dansville") > -1) {
				if (wordcount > 20) {subtotal = subtotal + 7.00 + (wordcount-20)*0.1} else {subtotal= subtotal + 7.00}
				if (document.classified.Photo != null) {
					if (Trim(document.classified.Photo.value) != "") {
						subtotal = subtotal + 5.00
						}
					}
				}
			if (fieldvalue.indexOf("perry") > -1) {
				if (wordcount > 20) {subtotal = subtotal + 5.50 + (wordcount-20)*0.1} else  {subtotal= subtotal + 5.50}
				if (document.classified.Photo != null) {
					if (Trim(document.classified.Photo.value) != "") {
						subtotal = subtotal + 15.50
						}
					}
				}
			if (fieldvalue.indexOf("warsaw") > -1) {
				if (wordcount > 20) {subtotal = subtotal + 5.50 + (wordcount-20)*0.1} else {subtotal= subtotal + 5.50}
				if (document.classified.Photo != null) {
					if (Trim(document.classified.Photo.value) != "") {
						subtotal = subtotal + 15.50
						}
					}
				}
			}
		}
	}
subtotal = subtotal*nweek; 
return subtotal;
}

function validateweeks(){
var e = 0;
var w = 0;
var nweek;
var weekvalue;
if (document.classified.Weeks.value != "") {
weekvalue = parseInt(document.classified.Weeks.value);
if (weekvalue != 0 && !isNaN(parseInt(document.classified.Weeks.value))) {
document.classified.Weeks.value = weekvalue;
}
else { 
alert("Please a valid number.");
document.classified.Weeks.value = "";
document.classified.Weeks.focus();
}
}
//calculate ad total
e = document.classified.Edition.value
w = document.classified.Len.value
adtotal (w, e);
}

function IsWeek(){
var e = 0;
var w = 0;
var nweek;
var weekvalue;
if (document.classified.Weeks.value != "") {
weekvalue = parseInt(document.classified.Weeks.value);
if (weekvalue != 0 && !isNaN(parseInt(document.classified.Weeks.value))) {
document.classified.Weeks.value = weekvalue;
}
else { 
alert("Please a valid number.");
document.classified.Weeks.value = "";
document.classified.Weeks.focus();
}
}
}


function ValidateClassified(){
var message = " ";
if (document.classified.Description.value==0) {
message = "\nPlease enter your ad."
}

if (document.classified.Weeks.value==0) {
message = message + "\nPlease enter Total Number of Weeks To Run."
}

if (message != " ") {
alert(message);
return false
}
return true

}

function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}

function CheckBVForm()
 {
	var string1 = "";
	var textcount = 0;
	if (Trim(document.bv.bvfirstname.value).length==0)
	 {
		alert("Please enter your first name.");
		document.bv.bvfirstname.focus();
		return false;
		} 

	if (Trim(document.bv.bvlastname.value).length==0)
	 {
		alert("Please enter your last name.");
		document.bv.bvlastname.focus();
		return false;
		} 
	
	if (validEmail(Trim(document.bv.bvemail.value))==false)
	 {
		alert("Please enter a valid email address.");
		document.bv.bvemail.focus();
		return false;
		} 
		
	radiochecked = -1
	for (i=0; i<document.bv.bvcategory.length; i++) {
		if (document.bv.bvcategory[i].checked) {
		radiochecked = i;
		}
	}
	if (radiochecked == -1) {
		alert("Please indicate the type of comments.");
		return false;
	}

	if (Trim(document.bv.bvcomments.value).length==0)
	 {
		alert("Please enter your comments.");
		document.bv.bvcomments.focus();
		return false;
		} 
	
	string1 = document.bv.bvcomments.value
	textcount = counter(string1)
	if (textcount > 100) {
		alert("Please limit your comments to 100 words or fewer.");
		document.bv.bvcomments.focus();
		return false;
	}
}

function CheckBVFeedback()
 {
	var string1 = "";
	var textcount = 0;
	if (Trim(document.bv.bvfirstname.value).length==0)
	 {
		alert("Please enter your first name.");
		document.bv.bvfirstname.focus();
		return false;
		} 

	if (Trim(document.bv.bvlastname.value).length==0)
	 {
		alert("Please enter your last name.");
		document.bv.bvlastname.focus();
		return false;
		} 
	
	if (validEmail(Trim(document.bv.bvemail.value))==false)
	 {
		alert("Please enter a valid email address.");
		document.bv.bvemail.focus();
		return false;
		} 
		
	if (Trim(document.bv.bvcomments.value).length==0)
	 {
		alert("Please enter your comments.");
		document.bv.bvcomments.focus();
		return false;
		} 
	
	string1 = document.bv.bvcomments.value
	textcount = counter(string1)
	if (textcount > 100) {
		alert("Please limit your comments to 100 words or fewer.");
		document.bv.bvcomments.focus();
		return false;
	}
}

function wordCounter(field, textfield, maxlength) {
var string1 = " ";
//Count the number of words in the description field
if (field.value != "undefined" && field.value != "null" && field.value != null) {
string1 = field.value
}
textfield.value = counter(string1);
}

function CharCounter(field, textfield) {
var string1 = " ";
if (field.value != "undefined" && field.value != "null" && field.value != null) {
string1 = field.value
}
textfield.value = Trim(string1).length;
}


function ValidateForm(thisform) {
if (thisform._required != null) {
	if (Trim(thisform._required.value).length != "") {
	var fieldnames = thisform._required.value.split(",");
	var errormsg = "The form can not be submitted. Please complete all required information.";
		for (m=0; m<fieldnames.length; m++) {
			fieldname = Trim(fieldnames[m]);
			if (thisform.elements[fieldname].length===undefined) {
				if (Trim(thisform.elements[fieldname].value).length=="") {
		   		alert(errormsg);
				thisform.elements[fieldname].focus();
				return false;
					}
				emailfield = fieldname.toLowerCase();
				if (emailfield.indexOf("email")>-1) {
					if (validEmail(Trim(thisform.elements[fieldname].value))==false) {
					alert("Please enter a valid email address.");
					thisform.elements[fieldname].focus();
					return false;
						}
					}
				}
			else {
				thischecked = -1
				for (i=0; i<thisform.elements[fieldname].length; i++) {
					if (thisform.elements[fieldname][i].checked || (thisform.elements[fieldname][i].selected && thisform.elements[fieldname][i].value.length!="")) {
					thischecked = i;
						}
					}
				if (thischecked == -1) {
					alert(errormsg);
					return false;
					thisform.elements[fieldname][0].focus;
					}
				
				}
			}
		}
	}
}

function ValidateFormMaxLen(thisform, thisfield, maxlength) {
	  	//maxlength = 50;
		textlength = counter(thisfield.value);
		if (textlength > maxlength) {
			alert("Please limit the text to " + maxlength + " words.");
			thisfield.focus();
			return false;
			}
		
		if (ValidateForm (thisform) == false) {
			return false;
		}
	  }


function open_cvc( url )
{
	pop_cvc = window.open( url, 'pop_cvc', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=1,copyhistory=no,width=400,height=550' );
	pop_cvc.focus();
}

function top_banner()
{
var img_width = "468";
var img_height = "60";
var img_border = "0";
var img_title = "Click Here";

var ad=new Array()
//insert here your images src
//ad[0]='http://www.gvpennysaver.com/banners/ezscratch_top.gif';
ad[0]='http://www.gvpennysaver.com/banners/07_leadingtheway_sm.gif';
ad[1]='http://www.gvpennysaver.com/images/07_pennylanebanner.gif';
ad[2]='http://www.gvpennysaver.com/banners/direct_express.gif';

var links=new Array()
//insert here your links
//links[0]='http://www.ezscratchpads.com/';
links[0]='http://www.plpp.info/featuredproduct/index.aspx?DPSV_Id=63815';
links[1]='http://www.gvpennysaver.com/contactus.asp';
links[2]='http://www.gvpennysaver.com/contactus.asp';
var xy=Math.floor(Math.random()*ad.length);
document.write('<a href="'+links[xy]+'" target="_blank"><img src="'+ad[xy]+'" width="'+img_width+'" height="'+img_height+'" border="'+img_border+'" alt="'+img_title+'"></a>');
}

function mmLoadMenus() {
  if (window.mm_menu_0305112411_0) return;
  window.mm_menu_0305112411_0 = new Menu("root",130,18,"Arial, Helvetica, sans-serif",12,"#296B4A","#000000","#FFFFFF","#D6E7DE","left","middle",3,0,500,-5,7,true,true,true,0,true,true);
  mm_menu_0305112411_0.addMenuItem("Direct Mail","location='mailto:loriebrowne@gvpennysaver.com'");
  mm_menu_0305112411_0.addMenuItem("Penny Lane Printing","location='http://www.pennylaneprinting.com/'");
  mm_menu_0305112411_0.addMenuItem("Promotional Products","location='http://www.plpp.info/featuredproduct/index.aspx?DPSV_Id=63815'");
   mm_menu_0305112411_0.hideOnMouseOut=true;
   mm_menu_0305112411_0.bgColor='#555555';
   mm_menu_0305112411_0.menuBorder=1;
   mm_menu_0305112411_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0305112411_0.menuBorderBgColor='#296B4A';

mm_menu_0305112411_0.writeMenus();
} // mmLoadMenus()

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];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function random_banner()
{
var img_width = "468";
var img_height = "60";
var img_border = "0";
var img_title = "Click Here";

var ad=new Array()
//insert here your images src
//ad[0]='http://www.gvpennysaver.com/banners/ezscratch_top.gif';
ad[0]='http://www.gvpennysaver.com/banners/07_leadingtheway_sm.gif';
ad[1]='http://www.gvpennysaver.com/images/07_pennylanebanner.gif';
ad[2]='http://www.gvpennysaver.com/banners/direct_express.gif';
ad[3]='http://www.gvpennysaver.com/banners/Advertise Here Banner.gif';
ad[4]='http://www.gvpennysaver.com/banners/plpp_wowspecials.jpg';
ad[5]='http://www.gvpennysaver.com/banners/htannounce.jpg';
ad[6]='http://www.gvpennysaver.com/banners/htannounce_birth.jpg';

var links=new Array()
//insert here your links
//links[0]='http://www.ezscratchpads.com/';
links[0]='http://plpp.info/';
links[1]='http://www.gvpennysaver.com/contactus.asp';
links[2]='http://www.gvpennysaver.com/contactus.asp';
links[3]='http://www.gvpennysaver.com/adv_bannersubmission.asp';
links[4]='http://www.plpp.info/featuredproduct/index.aspx?DPSV_Id=63815';
links[5]='http://www.gvpennysaver.com/hometown/announcement_cat.aspx';
links[6]='http://www.gvpennysaver.com/hometown/announcement.aspx?id=2';

// var xy is a random number chosen from the number of banner ad images in the ad array
var xy=Math.floor(Math.random()*ad.length);

// var yz is a random number, 0 or 1, used to determine whether the gvps banner ads will
// be displayed or the google banner ads
var yz=Math.floor(Math.random()*2.3);
var script='script';


document.write('<a href="'+links[xy]+'" target="_blank"><img src="'+ad[xy]+'" width="'+img_width+'" height="'+img_height+'" border="'+img_border+'" alt="'+img_title+'"></a>');

/*if (yz <= 0) {
// if yz is 0 show a gvps banner ad
document.write('<a href="'+links[xy]+'" target="_blank"><img src="'+ad[xy]+'" width="'+img_width+'" height="'+img_height+'" border="'+img_border+'" alt="'+img_title+'"></a>');
}
else {
// if yz is 1 show a google banner ad
document.write('<'+script+' type="text/javascript">google_ad_client="pub-1320630548792163";google_ad_slot="4289489112";google_ad_width=468;google_ad_height=60;</'+script+'><'+script+' type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></'+script+'>');
}*/
}
