// JavaScript Document

var popbackground="#272D36" //specify backcolor or background image for pop window
var windowtitle="jen-cook.com Preview"  //pop window title
function detectexist(obj){
return (typeof obj !="undefined")
}

function popimagePreview(imgpath, popwidth, popheight, textdescription){

function getpos(){
leftpos=(detectexist(window.screenleft))? screenleft+document.body.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0
toppos=(detectexist(window.screenMiddle))? screenMiddle+document.body.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0
if (window.opera){
leftpos-=screenleft
toppos-=screenMiddle
}
}

getpos()
var winattributes='width='+popwidth+',height='+popheight+',resizable=yes,scrollbars=yes,left='+leftpos+',top='+toppos
var bodyattribute=(popbackground.indexOf(".")!=-1)? 'background="'+popbackground+'"' : 'bgcolor="'+popbackground+'"'
if (typeof popwin=="undefined" || popwin.closed)
popwin=window.open("","",winattributes)
else{
//getpos() //uncomment these 2 lines if you wish subsequent popups to be centered too
//popwin.moveTo(leftpos, toppos)
popwin.resizeTo(popwidth, popheight+30)
}
popwin.document.open()
popwin.document.write('<html><head></head><title>'+windowtitle+'</title><body '+bodyattribute+'><table align="center"><img src="'+imgpath+'" style="margin-bottom: 0.5em"><br><a href="#" onClick="window.open('+textdescription+');"></a></table></body></html>')
popwin.document.close()
popwin.focus()
}

function openWindowContact() {
	newWindow = window.open("contact.php", "newWin", "toolbar=no,location=no,scrollbars=yno,width=635,height=335")
}
function openWindowLink() {
	newWindow = window.open("links.php", "newWin", "toolbar=no,location=no,scrollbars=yes,width=800,height=650")
}
function openWindowNews() {
	newWindow = window.open("hot_news.php", "newWin", "toolbar=no,location=no,scrollbars=yes,width=800,height=650")
}
function openWindowStore() {
	newWindow = window.open("inner-store.php", "newWin", "toolbar=no,location=no,scrollbars=yes,width=320,height=600")
}
function openWindow2GI() {
	newWindow = window.open("http://www.2gi.biz", "newWin", "toolbar=yes,location=yes,scrollbars=yes,width=800,height=650")
}

function openWindowccb() {
	newWindow = window.open("ccbill.php", "newWin", "toolbar=no,location=no,scrollbars=yes,width=800,height=650")
}

function openWindowccbsupport() {
	newWindow = window.open("https://support.ccbill.com", "newWin", "toolbar=no,location=no,scrollbars=yes,width=800,height=650")
}
function openbiocomp() {
	newWindow = window.open("bio-comp.php", "newWin", "toolbar=no,location=no,scrollbars=Yes,width=630,height=525")
}
function openwebcompcard() {
	newWindow = window.open("web-comp-card.php", "newWin", "toolbar=no,location=no,scrollbars=Yes,width=630,height=525")
}
function openlogin() {
	newWindow = window.open("login-module.php", "newWin", "toolbar=no,location=no,scrollbars=Yes,width=630,height=525")
}

function Swimwear() {
	newWindow = window.open("images/swimwear/gallery.php", "newWin", "toolbar=no,location=no,scrollbars=yes,width=800,height=650")
}
function Lingerie() {
	newWindow = window.open("images/lingerie/gallery.php", "newWin", "toolbar=no,location=no,scrollbars=yes,width=800,height=650")
}
function Candid() {
	newWindow = window.open("images/candid/gallery.php", "newWin", "toolbar=no,location=no,scrollbars=yes,width=800,height=650")
}
function Miscellaneous() {
	newWindow = window.open("images/miscellaneous/gallery.php", "newWin", "toolbar=no,location=no,scrollbars=yes,width=800,height=650")
}

isNN = document.layers ? 1 : 0; 

function noContext(){return false;}

function noContextKey(e) {
    if(isNN){
        if (e.keyCode == 96){ return (false);}
    } else {
        if (event.keyCode == 96){ return (false);}
    }
}

function noClick(e){
    if(isNN){
        if(e.which > 1) {return false;}
    } else { 
        if(event.button > 1){return false;}
    }
}

if(isNN){ 
    document.captureEvents(Event.MOUSEDOWN);
}

document.oncontextmenu = noContext;
document.onkeypress    = noContextKey;
document.onmousedown   = noClick;
document.onmouseup     = noClick;

/* This function determines whether or not to show the gallery
   if a user tries to access this page, it redirects them to the homepage */
   
function gallery(active)
{
	if  (active == 'no')
	{
		window.location = "http://localhost/jen-cook-new/index.php"	;
	}
}

/* This function determines whether or not to show the page depending on the live date.
   If a user tries to access this page, when the date is less then the live date
   it redirects them to the homepage */
   
function activeDay(date)
{
	var currentTime = new Date()
	var day = currentTime.getDate()
	var month = currentTime.getMonth()
	var year = currentTime.getFullYear()
	var currentDate = (month + "/" + day + "/" + year);
	
	var releaseDate = (date);
	if  (currentDate <= releaseDate)
	{
		window.location = "http://localhost/jen-cook-new/index.php"	;
	}
}


function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=480,height=722,left = 100,top = 100');");
}

function validate_form ( )
{
    valid = true;

    if ( document.order.first_name.value == "" )
    {
	
        alert ( "Please fill in the 'First Name' box." );
        valid = false;
    }
	if ( document.order.last_name.value == "")
	{
	  alert ( "Please fill in the 'Last Name' box." );
        valid = false;
    }
	if ( document.order.address1.value == "")
	{
	  alert ( "Please fill in the 'Address' box." );
        valid = false;
    }
	if ( document.order.zip.value == "")
	{
	  alert ( "Please fill in the 'Zip Code' box." );
        valid = false;
    }
	if ( document.order.email.value == "")
	{
	  alert ( "Please fill in the 'Email Address' box." );
        valid = false;
    }

    return valid;
}
newWindow = null
function closeWindow() {
	if (newWindow && !newWindow.closed) {
		newWindow.close()
		}
	}



