﻿// JScript File

var currentdate = 0
var core = 0

function StringArray (n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '
  }
}

image = new StringArray(10)
image[0] = 'images/banners/Banner-01.jpg'
image[1] = 'images/banners/Banner-02.jpg'
image[2] = 'images/banners/Banner-03.jpg'
image[3] = 'images/banners/Banner-04.jpg'
image[4] = 'images/banners/Banner-05.jpg'
image[5] = 'images/banners/Banner-06.jpg'
image[6] = 'images/banners/Banner-07.jpg'
//image[7] = '../images/Banner-08.jpg'
//image[8] = '../images/Banner-09.jpg'
//image[9] = '../images/Banner-10.jpg'

function ranimage() {
   return(image[Math.floor(7*Math.random())]);
}

function display(div,txt)
{
    document.getElementById(div).style.display = 'block';
    document.getElementById(txt).focus();
    return false;
}
function hide(div,txt,txt1)
{
    document.getElementById(div).style.display = "none";
    document.getElementById(txt).value = "";
    document.getElementById(txt1).value = "";
    return false;
}

function PrintPage()
{
    var PageToPrint = document.getElementById("body_wrapper");
    newWin = window.open('','p');
    newWin.document.open();
    newWin.document.write(PageToPrint.innerHTML);
    //newWin.style.width = "800px";
    //alert("a");
    //newWin.style.height = "550px";
    newWin.print();
    //newWin.close();
}

function PrintPage1()
{
    var PageToPrint = document.getElementById("Section_body");
    var disp_setting = "width=750, height=600, scroll=auto"
    var docprint = window.open("","",disp_setting);
    docprint.document.write('<html><head><title>Al-Othaim Holding</title></head>'); 
    docprint.document.write('<body onLoad="self.print()"><center><div style="direction:rtl;">');
    docprint.document.write(PageToPrint.innerHTML);
    docprint.document.write('</div></center></body></html>'); 
    docprint.document.close();
}

var shell; 
function SetPrintProperties() { 
try { 
shell = new ActiveXObject("WScript.Shell"); 
shell.SendKeys("%fu"); 
window.setTimeout("javascript:SetPaperSize();", 1200); 
window.setTimeout("javascript:SetLandScape();", 2000); 
//SetPaperSize();
//SetLandScape();
} catch (e) { 
alert('Please verify that your print settings have a Landscape orientation and minimum margins.'); 
} 
} 
function SetPaperSize() { 
shell.sendKeys("%a{TAB}.2{TAB}0{TAB}0{TAB}0{ENTER}"); 
} 
function SetLandScape() { 
shell.sendKeys("%fp"); 
window.print(); 
} 
function Save_Doc()
{
    document.execCommand("Saveas");
    return false;
}
function CreatePage()
{
    alert("a");
    fso = Server.CreateObject("scripting.filesystemobject");
    ctext = fso.createtextfile("d:\CV.html", True);
    ctext.WriteLine(body);
    ctext.close();
    ctext = Nothing;
    fso = Nothing;  
    return false;
}
function CreatePage1()
{   
    var fso,ctext;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    alert("a");
    ctext = fso.CreateTextFile("d:\\CV.html", True);
    ctext.WriteLine('body');
    ctext.close();
    ctext = Nothing;
    fso = Nothing;  
    return false;
}
function FileTest()
{
    var myObject, f;
    alert("a");
    myObject = new ActiveXObject("Scripting.FileSystemObject");
    f = myObject.CreateTextFile("c:\\suhaibtesting.txt", false);
    document.write("The name of the file is: " + f.Name);
    return false;   
}