//WINDOW
window.name = "main";
window.focus();
//PHOTO LOADER
function photoLoader(image,width,height,title){
var maxWidth = screen.width-110
var maxHeight = screen.height-110
//formatting image within limits
if(width>maxWidth || height>maxHeight){
if(maxWidth*height/width <= maxHeight){
height = Math.round(maxWidth*height/width)
width = maxWidth
} else {
width = Math.round(maxHeight*width/height)
height = maxHeight
}
}
var imageURL = image
var windowW = width
var windowH = height
// set the screen position where the popup should appear
var windowX = (screen.width/2)-(windowW/2);
var windowY = (screen.height/2)-(windowH/2);
// set this to true if the popup should close
// upon leaving the launching page; else, false
var autoclose = true
var s = "width="+windowW+",height="+windowH;
//
var popVDS = "photoholder.asp?imageURL="+imageURL+"&width="+width+"&height="+height+"&title="+title
var popWindow = window.open(popVDS,"sitephotos","scrollbars=no,"+s)
popWindow.blur()
window.focus()
popWindow.resizeTo(windowW,windowH)
popWindow.moveTo(windowX,windowY)
popWindow.focus()
if (autoclose){
window.onunload = function(){
if (popWindow && popWindow.open && !popWindow.closed){
popWindow.opener = null;
popWindow.close()
}
}
}
}
//PAGE POPUP WINDOW SCRIPT
function pageLoader(page,width,height,name){
// set this to true if the popup should close
// upon leaving the launching page; else, false
var autoclose = true
var maxWidth = screen.width;
var maxHeight = screen.height;
//formatting image within limits
if(width > maxWidth || height > maxHeight){
if(maxWidth*height/width <= maxHeight){
height = Math.round(maxWidth*height/width);
width = maxWidth;
} else {
width = Math.round(maxHeight*width/height);
height = maxHeight;
}
}
var windowW=width;
var windowH=height;
// set the screen position where the popup should appear
var windowX = (screen.width/2)-(windowW/2);
var windowY = (screen.height/2)-(windowH/2);
var s = "width="+windowW+",height="+windowH;
//name of app
pageName=name
//
var pageVDS=page;
var pageWindow=window.open(pageVDS,pageName,"scrollbars=no,status=no,"+s);
pageWindow.blur();
window.focus();
pageWindow.resizeTo(windowW,windowH);
pageWindow.moveTo(windowX,windowY);
pageWindow.focus();
if (autoclose){
window.onunload = function(){
if (pageWindow && pageWindow.open && !pageWindow.closed){
pageWindow.opener = null;
pageWindow.close();
}
}
}
}
//NEWSLETTER SUBSCRIPTION
function checkEmail(){
//Check for an e-mail address and that it is valid
if ((document.frmList.email.value == "") || (document.frmList.email.value.length > 0 && (document.frmList.email.value.indexOf("@",0) == -1 || document.frmList.email.value.indexOf(".",0) == -1))) {
msg = "____________________________________________________________________\n\n";
msg += "Your submission has failed because there are problem(s) with the form.\n";
msg += "Please correct the problem(s) and re-submit the form.\n";
msg += "____________________________________________________________________\n\n";
msg += "The following field(s) need to be corrected: -\n";
msg += "\n\tEmail Address \t- Please enter your valid email address";
errorMsg=msg;
alert(errorMsg);
document.frmList.email.focus();
return false;
} else {
return true;
}
}
//SEARCH ENGINE
function checkSearch() {
var errorMsg = "";
if (document.frmSearch.search.value == ""){
errorMsg += "\n\tSearch \t- Please enter at least one word to search for";
}
if (errorMsg != ""){
msg = "____________________________________________________________________\n\n";
msg += "Your Search of our website has failed because there are problem(s) with the form.\n";
msg += "Please correct the problem(s) and re-submit the form.\n";
msg += "____________________________________________________________________\n\n";
msg += "The following field(s) need to be corrected: -\n";
alert(msg + errorMsg + "\n\n");
document.frmSearch.search.focus();
} else {
if(document.frmSearch.sitesearch.length > -1){
for(i=0;i < document.frmSearch.sitesearch.length;i++){
if(document.frmSearch.sitesearch[i].checked){
sitesearch=document.frmSearch.sitesearch[i].value;
}
}
} else {
sitesearch=document.frmSearch.sitesearch.value;
}
if(sitesearch=="mcw"){
document.frmSearch.action="search.asp";
document.frmSearch.method="get";
document.frmSearch.submit();
} else {
searchUrl="google.asp?q=" + document.frmSearch.search.value + "&domains=" + document.frmSearch.domains.value + "&sitesearch=" + sitesearch;
window.open(searchUrl);
}
}
}
//BUTTON TOOLTIP FOR DEFAULT BUTTONS
function buttonTip(section,selected){
var tipText="iyanolapictures.org";
tipText+="
"+section.toUpperCase()+"";
//if this is the active site section
if(selected){
tipText+="
Browse this section with the floating menu above.";
}
//show tooltip
showtip(tipText);
}
//OPEN CHATROOM
function openChat(url){
chatWindow=window.open(url);
}
//COOKIE FUNCTIONS
/**
* Sets a Cookie with the given name and value.
*
* name Name of the cookie
* value Value of the cookie
* [expires] Expiration date of the cookie (default: end of current session)
* [path] Path where the cookie is valid (default: path of calling document)
* [domain] Domain where the cookie is valid
* (default: domain of calling document)
* [secure] Boolean value indicating if the cookie transmission requires a
* secure transmission
*/
function setCookie(name, value, expires, path, domain, secure)
{
document.cookie= name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
/**
* Gets the value of the specified cookie.
*
* name Name of the desired cookie.
*
* Returns a string containing value of specified cookie,
* or null if cookie does not exist.
*/
function getCookie(name)
{
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1)
{
begin = dc.indexOf(prefix);
if (begin != 0) return null;
}
else
{
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
if (end == -1)
{
end = dc.length;
}
return unescape(dc.substring(begin + prefix.length, end));
}
/**
* Deletes the specified cookie.
*
* name name of the cookie
* [path] path of the cookie (must be same as path used to create cookie)
* [domain] domain of the cookie (must be same as domain used to create cookie)
*/
function deleteCookie(name, path, domain)
{
if (getCookie(name))
{
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}
//SIDEBAR SCRIPT
//set right bar to be closed on next call
dir=0;
//sideBar manipulation function
function sideBar(){
if (ie4 || ns6){
//place object in variable
var obj= document.getElementById("sideBar");
if(dir==1){
//open
obj.style.visibility="visible";
obj.style.width=250;
//reset dir to close
dir=0;
//Set side bar cookie opened
setCookie("sideBar", "opened");
} else {
//close
obj.style.width=0;
obj.style.visibility="hidden";
//reset dir to open
dir=1;
//Set side bar cookie closed
setCookie("sideBar", "closed");
}
}
}
//
function resetSideBar(){
if(getCookie("sideBar")!="opened"){
sideBar();
}
}
//GET BACK TO HOME PAGE
function homePage(){
if (window.opener && !window.opener.closed){
window.opener.focus();
window.close();
} else {
window.location="/default.asp";
}
}
//OPEN MP3 PAGE
//GET BACK TO HOME PAGE
function mp3Page(){
if (window.opener && !window.opener.closed){
window.opener.location="/mp3.asp";
window.opener.focus();
window.close();
} else {
window.location="/mp3.asp";
}
}