
// JavaScript Tools JS file For Cinnergen.com

// Start PopUp IFrame Window Functions -----------------------------------------------------------------

// Start PopUp IFrame Window
function popfuction(iframepage,winset) {

if (winset == 2) {  // WinSet 2 = Video Testimonials
var IFWidth = 320;      // popup window Two size
var IFHigh = 260;
var myLEFTadj = 0;  // popup window Two offset adjust > OK To Use Negtive Values
var myTOPadj = 0;
}

var show = 'visible';

function getObj(name) {  // Function To Get HTML Object And Style
if (document.getElementById) {
this.obj = document.getElementById(name);
this.style = document.getElementById(name).style;
}
else if (document.all) {
this.obj = document.all[name];
this.style = document.all[name].style;
}
}

var x = new getObj('popup'); // Must Be The ID/NAME Of The Iframe

var myWidth = 0, myHeight = 0;  //  Start Of determine ViewPort Width And Height
if( typeof( window.innerWidth ) == 'number' ) {
  //Non-IE
  myWidth = window.innerWidth;
  myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
  //IE 6+ in 'standards compliant mode'
  myWidth = document.documentElement.clientWidth;
  myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
  //IE 4 compatible
  myWidth = document.body.clientWidth;
  myHeight = document.body.clientHeight;
}
// window.alert( 'Width = ' + myWidth );
// window.alert( 'Height = ' + myHeight );

var scrOfX = 0, scrOfY = 0;  //  Start Of determine ViewPort ScrollWidth And ScrollHeight
if( typeof( window.pageYOffset ) == 'number' ) {
  //Netscape compliant
  scrOfY = window.pageYOffset;
  scrOfX = window.pageXOffset;
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
  //DOM compliant
  scrOfY = document.body.scrollTop;
  scrOfX = document.body.scrollLeft;
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
  //IE6 standards compliant mode
  scrOfY = document.documentElement.scrollTop;
  scrOfX = document.documentElement.scrollLeft;
}
// window.alert( 'ScrolWidth = ' + scrOfX );
// window.alert( 'ScrolHeight = ' + scrOfY );

var LeftEdg = (myWidth - IFWidth) / 2;
var TopEdg = (myHeight - IFHigh) / 2;

var LeftEdg = LeftEdg + scrOfX;
var TopEdg = TopEdg + scrOfY;

var IFLeft = LeftEdg + myLEFTadj;
var IFTop = TopEdg + myTOPadj;

frames[0].location.href = iframepage;  // Note If More Than 1 IFrame Change Number To Target Frame
x.style.top = IFTop+'px';
x.style.left = IFLeft+'px';
x.style.width = IFWidth+'px';
x.style.height = IFHigh+'px';
x.style.visibility = show;

} // End of PopUp IFrame Window function


// Start of Close PopUp IFrame Window function
function HideIFrame(){

var page = 'blank.html';      // popup IFrame preload page

function getObj(name) {  // Function To Get HTML Object And Style
if (document.getElementById) {
this.obj = document.getElementById(name);
this.style = document.getElementById(name).style;
}
else if (document.all) {
this.obj = document.all[name];
this.style = document.all[name].style;
}
}

var y = new getObj('popup'); // Must Be The ID/NAME Of The Iframe

var hide = 'hidden';

var IFClose = 1;

//clearInterval(StopScroller);

y.style.visibility = hide;
y.style.width = IFClose+'px';
y.style.height = IFClose+'px';
frames[0].location.href = page;  // Note If More Than 1 IFrame Change Number To Target Frame
} // End of Close PopUp IFrame Window function



