function doDropDownChange(objThis){

    //alert(objThis.value); //.options[objThis.selectedIndex].value );
    //alert(document.forms[0].dropDownCount.value);
    
    var newCriteria = "";
    var dropObject;
    var delimiter   = "||";

    for(i=0; i < document.forms[0].dropDownCount.value; i++){

        dropObject = document.forms[0].elements["dropSelect" + i];
        
        if(i == document.forms[0].dropDownCount.value - 1)
            delimiter = "";

        newCriteria += dropObject.options[dropObject.selectedIndex].value + delimiter;

    }
    
    //document.write(document.forms[0].elements["values_"+newCriteria]);

    if(document.forms[0].elements["values_"+newCriteria] + "" == "undefined"){
        alert("Sorry this combination is not valid . . .\n\nPlease select different attributes!");
        document.forms[0].SKU.value                     = "";
        document.forms[0].Weight.value                  = "0";
        document.forms[0].price.value                   = "$0.00";
        document.forms[0].ProductUniqueIdentifier.value = "";
        document.forms[0].btBuy.disabled = true;
    }else{    
        
        var valuesArray = document.forms[0].elements["values_"+newCriteria].value.split("||");
        document.forms[0].SKU.value                     = valuesArray[0];
        document.forms[0].Weight.value                  = valuesArray[1];
        document.forms[0].price.value                   = valuesArray[2];
        document.forms[0].ProductUniqueIdentifier.value = valuesArray[3];
        document.forms[0].btBuy.disabled                = false;
    }
}


function buyNow(){
        Spawn_win_nav('/constructor/cart/inventory1.jsp?uniqueID=' + document.forms[0].ProductUniqueIdentifier.value +  '&iQuantity=' + document.forms[0].iQuantity.value  + '&iwebsiteID=' + document.forms[0].iwebsiteID.value);
}

function goNext(){
    
    var sNextUID = document.forms[0].sNext.value;
    var sCurrentUID = document.forms[0].sCurrentUID.value
    
    if(sNextUID==sCurrentUID)
        sNextUID = document.forms[0].sFirstUID.value

    sURL        = "/servlet/constructor.includeHTTP?iwebsiteID="        +   document.forms[0].iwebsiteID.value
                                                + "&isectionTypeID="    +   document.forms[0].isectionTypeID.value
                                                + "&isectionID="        +   document.forms[0].isectionID.value
                                                + "&ipageID="           +   document.forms[0].ipageID.value
                                                + "&skeywords="         +   sNextUID;
                
    location.href  = sURL;               


}


function goPrev(){
    
    var sPrevious = document.forms[0].sPrevious.value;
    var sCurrentUID = document.forms[0].sCurrentUID.value
    
    if(sPrevious==sCurrentUID)
        sPrevious = document.forms[0].sLastUID.value
    
    sURL        = "/servlet/constructor.includeHTTP?iwebsiteID="        +   document.forms[0].iwebsiteID.value
                                                + "&isectionTypeID="    +   document.forms[0].isectionTypeID.value
                                                + "&isectionID="        +   document.forms[0].isectionID.value
                                                + "&ipageID="           +   document.forms[0].ipageID.value
                                                + "&skeywords="         +   sPrevious;
                
    location.href  = sURL;               


}

function goToGallery(){
    
    sURL        = "/servlet/constructor.includeHTTP?iwebsiteID="        +   document.forms[0].iwebsiteID.value
                                                + "&isectionTypeID="    +   document.forms[0].isectionTypeID.value
                                                + "&isectionID="        +   document.forms[0].isectionID.value
                                                + "&ipageID="           +   document.forms[0].ipageID.value;
                
    location.href  = sURL;               


}


function logout(websiteID){

    if(confirm("Are you sure you want to log out?")){
        
        location.href = "/constructor/Security/logout.jsp?iwebsiteID=" + websiteID;
    }
}

function viewThisPage(pageID, websiteID, isectionTypeID){

    sURL        = "/servlet/constructor.includeHTTP?iwebsiteID="        +   websiteID
                                                + "&isectionTypeID="    +   isectionTypeID
                                                + "&ipageID="           +   pageID;
    
                
    location.href  = sURL;               


}

function doLink(iType){
    
    sURL        = "/servlet/constructor.includeHTTP?iwebsiteID="        +   document.forms[0].iwebsiteID.value      
                                                + "&isectionID="        +   document.forms[0].isectionID.value  
                                                + "&isectionTypeID="    +   iType                                   
                                                + "&ipageID="           +   document.forms[0].ipageID.value
                                                + "&previousSection="   +   document.forms[0].previousSection.value
                                                + "&skeywords="         +   document.forms[0].skeywords.value;
    
    //alert(sURL);
                
    location.href  = sURL;               

}


function getGenPage(iType){
	
	document.forms[0].action = "/constructor/wiz/main.jsp?iStatus=131313&iPageType=" + iType;
	document.forms[0].submit();

}


function checkFields(){

	
	var sTemp = "";
	
	//alert(document.forms.feedback.last.value);
	
	if(document.forms.feedback.last.value == "")
		sTemp =1;
	
	if(document.forms.feedback.email.value == "")
		sTemp =1;
	
	if(sTemp  == 1)
		alert("Please provide the required fields denoted by an asterix '*'");
	else
	   document.forms.feedback.submit();
}


function printit(){  
if (window.print) {
    window.print() ;  
} else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
}
}


//Array function
function makeArray(len){
for(var i=0; i < len; i++) this[i] = null;
this.length = len;
}

function getDate(){

var now = new Date();
var day = now.getDay();
var second = now.getSeconds();
var minute = now.getMinutes();
var hour = now.getHours();
var year = now.getYear();
var date = now.getDate();
var month = now.getMonth();

var dayname;
	if (day == 0) dayname ="Sunday";
	if (day == 1) dayname ="Monday";
	if (day == 2) dayname ="Tuesday";
	if (day == 3) dayname ="Wednesday";
	if (day == 4) dayname ="Thursday";
	if (day == 5) dayname ="Friday";
	if (day == 6) dayname ="Saturday";

var monthNames = new makeArray(12);
monthNames[0]= "January";
monthNames[1]= "February";
monthNames[2]= "March";
monthNames[3]= "April";
monthNames[4]= "May";
monthNames[5]= "June";
monthNames[6]= "July";
monthNames[7]= "August";
monthNames[8]= "September";
monthNames[9]= "October";
monthNames[10]= "November";
monthNames[11]= "December";


document.write(dayname + ", " + monthNames[month] + " " + date + ", " + year);

}

   function Spawn_win_nav(linkto, winWidth, winHeight){  
   var str;  
   str = "width=" + winWidth + ",height=" + winHeight + ",scrollbars=yes,resizable=1";  
   spawn10  = window.open(linkto, 'viewStyle', str );  
   //spawn10.window.moveTo(10,10);   

   if (spawn10.blur) spawn10.focus();  
   
   } 

   


function getParameter ( queryString, parameterName ) {
// Add "=" to the parameter name (i.e. parameterName=value)
var parameterName = parameterName + "=";
if ( queryString.length > 0 ) {
// Find the beginning of the string
begin = queryString.indexOf ( parameterName );
// If the parameter name is not found, skip it, otherwise return the value
if ( begin != -1 ) {
// Add the length (integer) to the beginning
begin += parameterName.length;
// Multiple parameters are separated by the "&" sign
end = queryString.indexOf ( "&" , begin );
if ( end == -1 ) {
end = queryString.length
}
// Return the string
return unescape ( queryString.substring ( begin, end ) );
}
// Return "null" if no parameter has been found
return "0";
}
}

function getObject(objName){

	return getParameter(document.location.href, objName); 
}

var gwebsiteID = 0;
gwebsiteID = getParameter(document.location.href, "iwebsiteID"); 


	function dolink(sLink){
		
		sLink = "/constructor/wiz/popframes.jsp?sURL=" + sLink
		
		Spawn_win_nav(sLink, 640, 480); //'calcs.asp?calc=autoloan'
	}
	
	
	
	
	
	var expDays = 30;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function getCookieVal (offset) {  
	var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1)    
	endstr = document.cookie.length;  
	return unescape(document.cookie.substring(offset, endstr));
}

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;
}


var MailingList = GetCookie("mailinglist");

function writeMailingBox(sUserName){
	
	if(MailingList != "true"){	
		document.write("<IFRAME   SRC=\"/constructor/wiz/PartofMailingList.jsp?websiteUser=" + sUserName + "\" FRAMEBORDER=0 WIDTH=130 HEIGHT=120 TITLE=\"Join Mailing list\"></IFRAME>");
	}
}

function writeLoginBox(sUserName){
    
    document.write("<IFRAME   SRC=\"/constructor/Security/loginBox.jsp?websiteUser=" + sUserName + "\" FRAMEBORDER=0 WIDTH=175 HEIGHT=72 TITLE=\"Join Mailing list\"></IFRAME>");
    
}

function Spawn_win_nav(linkto, winWidth, winHeight){  
   var str;  
   str = "width=" + winWidth + ",height=" + winHeight + ",scrollbars=yes,resizable=1";  
   var spawn2  = window.open(linkto, 'windowName', str );  
   if (spawn2.blur) {
   	spawn2.focus();  
   	
   }
     
} 


    function deleteItem(){

        if(confirm("Are you sure that you would like to remove this message?")){
            
            document.forms[0].actionID.value = "-3";
            document.forms[0].submit();
          
        }
    }

    function saveItem(){

        if(document.forms[0].subject.value == ""){
            alert("Please provide a Subject for your posting . . .");
            document.forms[0].subject.focus();

        }else{
            document.frames['contentFrame'].docSave();
            if(document.forms[0].Content.value == "<P>&nbsp;</P>" || document.forms[0].Content.value == "")
                alert("Please provide a Message for your posting . . .");
            else    
                document.forms[0].submit();
        }
    }

	